javascript - JQuery change function not working in safari browser -
i have radio button , checkbox
<input type='radio' name='testradiochange' id='testradiochange'> testing radio change</input> <input type='checkbox' name='acknowledge' id='acknowledge' value='acknowledge'></input> i want notified when these buttons selected
$("input[name=testradiochange]:radio").change(function () { alert('radio selected'); } $("input[name=acknowledge]:checkbox").change(function () { alert('checkbox selected'); } the above works fine in chrome , firefox not in safari. idea?
you have lots of typos in code, here :
$("input[name=testradiochange]:radio").change(function () { alert('radio selected'); }); // <= }, added ); close function's ( $("input[name=acknowledge]:checkbox").change(function () { if ($(this).is(':checked')) { // if check alert('checkbox selected'); } else { // if uncheck alert('checkbox unselected'); } }); // <= }, added ); close function's ( <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <label><input type='radio' name='testradiochange' id='testradiochange'/>testing radio change</label> <!-- inputs don't have closing tags, self-closing, if want display text next them, use label --> <input type='checkbox' name='acknowledge' id='acknowledge' value='acknowledge'/>
Comments
Post a Comment