1

I am trying to open child dropdown on its parent dropdown change event, In my form, I have 10 dropdowns which I need to open one-by-one on dropdown change event of its parent Select.

I tried lots of jquery snippets but those are working on desktop browsers only, NOT in mobile like http://jsfiddle.net/XE73h/444/

I have also tried size attribute as $("#sel").attr("size", 10); but it is also not working in mobile. (tried in Chrome for Andriod and Safari for iPhone devices)

Rishi Jagati
  • 626
  • 1
  • 6
  • 28

1 Answers1

0

To trigger the function with click or touch, you could change this:

$(document).click( function () {

To this:

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

Or this:

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

The touchstart event fires as soon as an element is touched, the touch event is more like a "tap", i.e. a single contact on the surface. You should really try each of these to see what works best for you. On some devices, touch can be a little harder to trigger (which may be a good or bad thing - it prevents a drag being counted, but an accidental small drag may cause it to not be fired). For reference you can see this link

Syed Uzair Uddin
  • 3,296
  • 7
  • 31
  • 47
  • I have used both the methods you suggested none of them is working. I opened http://jsfiddle.net/XE73h/444/ url in mobile and did the changes but nothing happened. – Rishi Jagati Sep 17 '17 at 08:59