0

I Have spent 4 hours trying to get this to work. But I want to make an tap event on a image open a tel: link. this code does nothing i got not Idea what else to do. Help would be greatly appreciated.

          <script>
    $(document).on('pageinit', function(){
        $("#phone").on('tap','#phone',function(){
       window.location.href= "tel:2063210041";
     });


    });
    </script>
    <img id="phone" src="call.gif">

1 Answers1

0

You can use vclick instead of tap and you don't need to put it inside the pageinit, just add it towards the end of the body tag.

$("#phone").on('vclick',function(){
    alert('tap');
   window.location = "tel:2063210041";
});

Run this fiddle on your phone, for me it asks to call the number when tapping the icon: http://jsfiddle.net/ezanker/45pwe/ (You can remove the alert('tap') line).

ezanker
  • 24,628
  • 1
  • 20
  • 35
  • Some info about vclick and tap: http://stackoverflow.com/questions/15274809/in-jquery-mobile-whats-the-diff-between-tap-and-vclick – DannyThunder Oct 14 '13 at 14:02