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); });
Comments
Post a Comment