Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery禁用Onclick事件 禁用单击 函数检查(){ 警惕(“你好”); $(“#禁用单击”).removeAttr('click'); }_Jquery - Fatal编程技术网

使用jquery禁用Onclick事件 禁用单击 函数检查(){ 警惕(“你好”); $(“#禁用单击”).removeAttr('click'); }

使用jquery禁用Onclick事件 禁用单击 函数检查(){ 警惕(“你好”); $(“#禁用单击”).removeAttr('click'); },jquery,Jquery,禁用onclick事件的语法可能是什么,上面的语法就是我尝试使用的语法 <a id="disableclick" onclick="check();">DisableClick</a> <script type="text/javascript"> function check() { alert("hello"); $("#disableclick").removeAttr('click'); } </scri

禁用onclick事件的语法可能是什么,上面的语法就是我尝试使用的语法

<a id="disableclick" onclick="check();">DisableClick</a>

<script type="text/javascript">    
function check() {
    alert("hello");
    $("#disableclick").removeAttr('click');        
}
</script>
或:

试试看

function check() {
        $("#disableclick").attr('onclick','');        
    }
而不是

$("#disableclick").removeAttr('onclick'); 

@SomnathKharat是的,这是一个输入错误。你能用jsfiddler做一个演示吗?它不是working@RajaprabhuAravindasamy:添加返回单击事件的语法是什么again@RajaprabhuAravindasamy$(“#disableclick”).attr('onclick','check();');如果我想在没有任何函数名的情况下启用onclick,我们可以按照什么语法再次添加$(“#disableclick”).attr('onclick','check();');
$("#disableclick").removeAttr('onclick'); 
$("#disableclick").removeAttr('click');