Find all link in a div element and disable them all

馋奶兔 提交于 2019-12-03 12:47:24

Try this:

 $("#content_div a").click(function(e) {
   e.preventDefault();
 });

I would rely less on jQuery as it might be disabled by the user, so if you want a CSS solution, you can do it like

#content_div {
   pointer-events: none;
   cursor: default;
}

Demo

Edit: To be precise, use this declaration #content_div a

$("#content_div a").css({"color":"#888888", cursor: "default"}).click(function(e){
   e.preventDefault();
});

Working Example http://jsfiddle.net/P4Fqq/

There are two ways here:

1) $('#content a').css({"pointer-events":"none"});

2) $('#content a').click(function(e){ e.preventDefault(); });

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!