禁用单击div [英] Disable click on a div

查看:68
本文介绍了禁用单击div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用点击某个< div> ,这样当你选择文字时,文字就不会选择。

I want to disable click on a certain <div> so that when you select the text on it, the text doesn't select.

我尝试写 onclick =return false;就像这个小提琴 http://jsfiddle.net/mageek/X6hqD/ 但它不起作用。

I tried writing onclick="return false;" like in this fiddle http://jsfiddle.net/mageek/X6hqD/ but it doesn't work.

它是如何工作的? (我的目标不仅仅是禁用选择,而是整个点击)。

How can it work? (My goal isn't just disabling the select, it's the whole click).

推荐答案

document.getElementById('div1').onmousedown = new function ("return false");

这篇关于禁用单击div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆