Reputation: 373
I'm trying to get a jquery selector to work and give a response on console.log()
on click however I cant seem to get it working.
Here is url
Code is:
$("div#tabs > div#problem-categories > div > div a").click(function() {
console.log('pass');
});
any help would be very much appreciated!
Upvotes: 2
Views: 102
Reputation: 74738
Use this:
$("div#problem-categories div.scrollbox").find('a').click(function(ev) {
ev.preventDefault(); // <-----use this to prevent the jump
console.log('pass');
});
You have to traverse through this way. Get into problem-categories' scrollbox
and find a
in it and do the click
.
Upvotes: 0
Reputation: 6948
This works good for me:
$("div#tabs > div#problem-categories > div > div a").on("click", function () {
console.log('pass');
})
Upvotes: 1
Reputation: 9105
You need to prevent the link from beeing submitted, try this :
$("#problem-categories a").click(function(e) {
e.preventDefault();
console.log('pass');
});
Upvotes: 2