0

Tap event doesn't seem to work for radio buttons.

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

This event does not fire. The click events seem to be working fine for radio buttons.

And tap events seem to be working for all 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 the submit button to submit the form.</p>

</body>
</html>

The Same works fine if i replace tap with click.

tap events are working fine otherwise so that's not the issue.

Vikash Balasubramanian
  • 2,921
  • 3
  • 33
  • 74
  • [difference-between-the-click-and-tap-events](http://stackoverflow.com/questions/12422944/what-is-the-difference-between-the-click-and-tap-events) – Leo Silence Jun 03 '15 at 04:09

1 Answers1

2

What you are missing is 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 this example from W3Schools.

Even though tap event is equivalent to click event in jquery, you need to add mobile library to make tap event work.

Check out this working JSFiddle for your case.

Akash Rajbanshi
  • 1,553
  • 11
  • 23