1
$(document).off("click", ".switch_cities").on("click", ".switch_cities", function(e) { 
        alert('uuuu');
        e.preventDefault();
        var r = $("#from").val(),
            t = $("#to").val();
        ("" != r || "" != t) && ($("#from").val(t), $("#to").val(r))
    })

The above code is used to switch cities in two text boxes it works in Firefox and chrome but it doesn't work in Various mobile views of chrome

Özgür Ersil
  • 6,909
  • 3
  • 19
  • 29

2 Answers2

0

In your javascript you use the on then click, technically you are not using click on a mobile phone.

You can try the accepted answer in the following link which has the same problem.

https://stackoverflow.com/a/22015946/2619909

Community
  • 1
  • 1
Lorenzo
  • 574
  • 5
  • 13
  • Can you give me the link? I'm starting to think that this may be cause by the OS of the phone having different API's. But if you have same OS in different phones, I'll try to do more research. – Lorenzo Aug 10 '16 at 07:02
0

Instead of using click, use tap event handlers. Judging by your above snippet you seem to use jQuery. jQuery has awesome event handlers, use this link to see how to utilize jQuery tap events.

Bonus point of using tap is they also seem to work on desktop browsers, as seen in the demo on the above link. Cheers!

Nasik Shafeek
  • 951
  • 8
  • 17