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?

[Webinar] Streamline your web hosting managementRegister Today

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
All Courses

From novice to tech pro — start learning today.