javascript - jquery tap event radio button -


tap event doesn't seem work radio buttons.

$(document).on("tap","input[type=radio]",function(e){//do something}); 

this event not fire. click events seem working fine radio buttons.

and tap events seem working other types of buttons.

complete html

<!doctype html>  <html>  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>  <script>  $(document).ready(function(){      $(document).on("tap","input[type=radio]",function(e){alert("tapped");});  });  </script>    <body>  <form action="#">    <input type="radio" name="gender" value="male">male<br>    <input type="radio" name="gender" value="female">female<br>    <input type="submit">  </form>    <p>click on submit button submit form.</p>    </body>  </html>

the same works fine if replace tap click.

tap events working fine otherwise that's not issue.

what missing jquery mobile library:

<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> 

you can check out example w3schools.

even though tap event equivalent click event in jquery, need add mobile library make tap event work.

check out working jsfiddle case.


Comments