Deselect an ID that would otherwise be selected by class

馋奶兔 提交于 2019-12-13 06:41:46

问题


I have a page where all inputs are assigned a behavior: $("input").blur(function () {

and I need to exclude a checkbox that has a specific id:

  <input type="checkbox" id="allButMe" onchange="billingSameChanged();" value="true"/> 

thx


回答1:


Use jQuery's not selector like this:

$("input:not(#allButMe)").blur(function() { });



回答2:


use jQuery not here

$("input").not("#allButMe").blur(function() {});


来源:https://stackoverflow.com/questions/2710400/deselect-an-id-that-would-otherwise-be-selected-by-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!