jquery click not working on data attribute

How come the following isn't working

<a href="#lnk" data-toggleIssue="details" data-issueid="1">

  $('a[data-toggle="details"]').click(function(){
        alert('eeeee');
    });

Open in new window

stargateatlantisAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
zappafan2k2Connect With a Mentor Commented:
Hmm.  The code you've shown will not match the element.
Your jQuery is looking for elements with attribute data-toggle="details", but your HTML shows an element with attribute data-toggleIssue="details".

In other words, they should both be either data-toggleIssue or data-toggle.  Better yet, give the elements a unique dummy class, which will be slightly faster.
0
 
GaryConnect With a Mentor Commented:
Code works fine
http://jsfiddle.net/GaryC123/PH6RZ/2/

Have you included jQuery?
Is the code inside a document ready block?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.