Using jQuery, what is the best way to set onClick event listeners for radio buttons?

$(document).ready(function(){
    $("input[name='area']").bind("click", radioClicks);
});

functionradioClicks() {
    alert($(this).val());
}

I like to use bind() instead of directly wiring the event handler because you can pass additional data to the event hander (not shown here but the data is a third bind() argument) and because you can easily unbind it (and you can bind and unbind by group--see the jQuery docs).

http://docs.jquery.com/Events/bind#typedatafn


$( function() {
    $("input:radio")
        .click(radioClicks)
        .filter("[value='S']")
        .attr("checked", "checked");
});

$(function() {

  $("form#myForm input[type='radio']").click( fn );

});

function fn()
{
   //do stuff here
}