本文介绍了如何在点击其他点击事件时触发点击事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$(document).ready(function(){
$('#datatable tbody').on('click', 'td:nth-child(1), td:nth-child(5), td:nth-child(8), td:nth-child(11)', function (event) {
if ($("#ValBool").val() == "false") {
Editable();
}
else {
event.stopImmediatePropagation();
alert("Not allowed");
}
});
function Editable(){
$('#datatable tbody').on('click', 'td:nth-child(1), td:nth-child(5), td:nth-child(8), td:nth-child(11)', function () {
var x = $(".itemEdit").length;
var getData = $(this).html();
//placing the data in the textbox again
if (x == 0) {
$(this).empty().html('<input type="text" value="' + getData + '" class="itemEdit" id="dataField"/>');
$('.itemEdit').focus();
}
});
}
</pre>
我想触发点击第一个事件的第二个事件。
问题是它只是在第一次加载页面时才被触发但是它工作正常
I want to trigger the second event on click on first event.
The problem is it is not getting triggered only the first time the page is loading but then it is working fine
The
$("#ValBool").val() == "false"
是我想要触发第二个事件的条件。
Is my condition for which i want to trigger the second event or not.
推荐答案
这篇关于如何在点击其他点击事件时触发点击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!