javascript - Radio Button Change not detected in JQuery -
can please me out, why change not being detected
here radio button form -
<form style = "padding:10px; margin:5px;" id="askmethod"> select option: <input type="radio" name="method" value ="textmethod" checked = "checked">type text <input type="radio" name="method" value ="imagemethod">upload image </form>
here jquery routine -
$(document).ready(function() { $('input [type=radio][name=method]').on('change', function() { switch ($(this).val()) { case 'textmethod': alert("text"); break; case 'imagemethod': alert("image"); break; } }); });
please use change
bellow
$('form#askmethod [type=radio][name=method]').change(function() { switch($(this).val()) { case 'textmethod': alert("text"); break; case 'imagemethod': alert("image"); break; });
Comments
Post a Comment