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
Related Q & A:
- How to get the column value when a row is selected in wpf listview?Best solution by Stack Overflow
- How to execute a selected statement?Best solution by Stack Overflow
- Why won't click events work for elements on iOS?Best solution by Stack Overflow
- Why is AdWords ignoring my daily budget?Best solution by Yahoo! Answers
- How and why are the wonders of the world selected?Best solution by quora.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.