javascript - How to open dropdowns in mobile browsers? -


i trying open child dropdown on parent dropdown change event, in form, have 10 dropdowns need open one-by-one on dropdown change event of parent select.

i tried lots of jquery snippets working on desktop browsers only, not in mobile http://jsfiddle.net/xe73h/444/

i have tried size attribute $("#sel").attr("size", 10); not working in mobile. (tried in chrome andriod , safari iphone devices)

to trigger function click or touch, change this:

$(document).click( function () { 

to this:

$(document).on('click touchstart', function () { 

or this:

$(document).on('click touch', function () { 

the touchstart event fires element touched, touch event more "tap", i.e. single contact on surface. should try each of these see works best you. on devices, touch can little harder trigger (which may or bad thing - prevents drag being counted, accidental small drag may cause not fired). reference can see link


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -