Skip to content Skip to sidebar Skip to footer

Button Click Event Not Firing In JQuery

This is the method: $(document).ready(function () { $('btnDelete1').click(function () { alert('something'); }) }); And this is the code for the button:

Solution 1:

The problem isn't connected with MVC anyway, you missed # in Jquery selector only.

$(document).ready(function () {
    $('#btnDelete1').click(function () {
        alert("something");
    });
});

EDIT:

And as mentioned Jeffrey, you forget ; too


Solution 2:

Your selector is wrong

It should be

$(document).ready(function () {
    $('#btnDelete1').click(function () {
        alert("something");
    });
});

Solution 3:

Did you forget a ;?

$(document).ready(function () {
    $('#btnDelete1').click(function () {
        alert("something");
    });
});

Post a Comment for "Button Click Event Not Firing In JQuery"