Reputation: 2596
I've looked on the forum and my question is a duplicate of Button click event not firing in jQuery, except my code already matches the given answer.
I've stripped this down for you guys anyway, and can confirm that links with a class of disabled do not fire, so this proves the document ready and Jquery library are correct.
Javascript
$(document).ready(function () {
// Prevents links from firing
$('a.disabled').click(function (e) {
e.preventDefault();
});
// Handles search
$("#btnTreeSearch").click(function () {
alert("click search fool!");
});
});
Html
<input type="submit" value="btnTreeSearch" />
Any clues?
Upvotes: 0
Views: 115
Reputation: 148110
You need to assign id
to input to use id selector
Html
<input type="submit" id="btnTreeSearch" value="btnTreeSearch" />
Javascript
$("#btnTreeSearch").click(function () {
alert("click search!");
});
Upvotes: 7