HI WELCOME TO KANSIRIS

How to enable or disable an anchor using jQuery?

Leave a Comment
To prevent an anchor from following the specified href, I would suggest using preventDefault():
// jQuery 1.7+
$(function () {
    $('a.something').on("click", function (e) {
        e.preventDefault();
    });
});

// jQuery < 1.7
$(function () {
    $('a.something').click(function (e) {
        e.preventDefault();
    });

    // or 

    $('a.something').bind("click", function (e) {
        e.preventDefault();
    });
});

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.