mer*_*erk 6 jquery jquery-selectors
有人可以帮我理解这行jquery代码吗?:
$(this).find('input[type="submit"]:not(.cancel), button').click(function ()
Run Code Online (Sandbox Code Playgroud)
我特别感兴趣.cancel,因为整个jquery代码块(这里没有包含)用于验证页面,我试图阻止验证,如果用户点击取消按钮.我猜测上面的代码行说它点击的提交按钮不是取消按钮,然后继续.
但我不知道如何将按钮指定为取消.
这里的答案很好.也许这个带注释的版本增加了一些价值.
$(this) // within this jQuery object
.find(' // find all elements
input[type="submit"] // that are input tags of type "submit"
:not(.cancel) // and do not have the class "cancel"
, // or
button // are button elements
')
.click( // and for each of these, to their click event
function (){} // bind this function
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20516 次 |
| 最近记录: |