这是否可以在元素内部事件中使用jquery ??
而不知道事件内部的函数由于
答案 0 :(得分:0)
请在jquery中尝试Off
方法
请参阅jQuery DOCS
答案 1 :(得分:0)
<form id="CreateForm" method="post">
<div class="editor-label">
<label for="Customer_FirstName">FirstName</label>
</div>
<div class="editor-field">
<input class="text-box single-line" id="Customer_FirstName" name="Customer.FirstName" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="Customer.FirstName" data-valmsg-replace="true"></span>
</div>
<div class="editor-label">
<label for="Customer_LastName">LastName</label>
</div>
<div class="editor-field">
<input class="text-box single-line" id="Customer_LastName" name="Customer.LastName" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="Customer.LastName" data-valmsg-replace="true"></span>
</div>
<p>
<input type="button" value="Create" />
<input type="button" value="ForceValidate" />
<button type="button" id="Disable" >Disable</button>
</p>
</form>
Jquery的
$(document).ready(function () {
$("input[type='button']").click(function () {
alert("test");
});
$("#Disable").click(function () {
$("input[type='button']").off("click");
});
});
请检查上面使用off
演示的演示,以便从输入类型按钮中删除事件