Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use jQuery to find a link within the div with a certain class and make it inactive

How to use jQuery to find a link within the div with a certain class and make it inactive, that is to deprive the property links to her it was impossible to push.

like image 646
Viktor Bogutskii Avatar asked Jan 12 '11 10:01

Viktor Bogutskii


1 Answers

$("div.someClass").find("a").removeAttr("href");

or if you would rather not get rid of the href attribute:

$("div.someClass a").click(function(e) {
    e.preventDefault();
});
like image 53
karim79 Avatar answered Oct 03 '22 06:10

karim79