且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何禁用在div中单击

更新时间:2021-11-17 15:22:03

可以使用的CSS属性是:

The CSS property that can be used is:

pointer-events:none

!重要
请注意,Opera Mini和IE 10及以下版本(包括)不支持此属性。这些浏览器需要另一种解决方案。

!IMPORTANT Keep in mind that this property is not supported by Opera Mini and IE 10 and below (inclusive). Another solution is needed for these browsers.

jQuery METHOD
如果要通过脚本而不是CSS属性禁用它们,这些可以帮助你:
如果你正在使用jQuery版本1.4.3 +:

jQuery METHOD If you want to disable it via script and not CSS property, these can help you out: If you're using jQuery versions 1.4.3+:

$('selector').click(false);

如果不是:

$('selector').click(function(){return false;});