javascript - jQuery detect select in radio button -


i want build form radio buttons, need detect if radio has bee selected.

it's quite easy function .change. in situation:

    $('input:radio').change(function() {     alert($('[name|="pyt10"]:checked').val() + " / " + $('[name|="pyt11"]:checked').val() + " / "+  }) 

but here small issue - have 3 groups of radios. when select first radio, alert shows me, fields udefined, after second select first radio has value, second still undefined, , on.

it means, alert shows radio value before change, not after.

what should write radio value after select ?

for immediate problem, "where need detect if radio has bee selected.", can use this:

var radios = $('input:radio').on("click", function () {     alert(radios.length === radios.filter(":checked").length); }); 

demo: http://jsfiddle.net/vwrzn/1/


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -