Why won't click events work for elements on iOS?

JQuery Ignoring Click Events In Webkit On Elements Selected Via Attribute?

  • I've run into an issue where click events are being ignored on elements selected by their attribute values in webkit browsers. To clarify, I'm attempting to trigger a click on the selected event, not bind a function to the click event. The HTML <div class="my_list">     <a href="#thumb_1">Thumb O1</a>     <a href="#thumb_2">Thumb O2</a>     <a href="#thumb_3">Thumb O3</a> </div> The jQuery var my_var = 1; $('.my_list a[href="#thumb_' + my_var + '"]').click(); The event fires in Firefox, but not Safari or Chrome. Also Tried var my_var = 1; $('.my_list a[href="#thumb_' + my_var + '"]').trigger('click'); Any help would be greatly appreciated, thanks.

  • Answer:

    It works for me in both Chrome and Chromium. See the code and click on the "Thumb O2" link. http://jsfiddle.net/qkrnn/1/

AJ Sethi at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.