[英]Using multiple jQuery selectors to filter
I am trying to add the jQueryUI datepicker on a certain group of datefields, but exclude fields whose id ends in -0 我正在尝试在某些日期字段组上添加jQueryUI datepicker,但排除ID以-0结尾的字段
Here is my code: 这是我的代码:
$(function() { $("input[id^='TOEFLtestDate-']").not([id$='-0']).datepicker({ onClose: function(dateText, inst){ GenericDateUpdate(this.id, dateText,1); } }); });
This code selects the correct pool of inputs: 此代码选择正确的输入池:
$(function() { $("input[id^='TOEFLtestDate-']").datepicker({ onClose: function(dateText, inst){ GenericDateUpdate(this.id, dateText,1); } }); });
I just can't seem to get the filtering right to filter out the ids that end in -0. 我似乎似乎无法正确过滤掉以-0结尾的id。
Thanks for any help. 谢谢你的帮助。
You just need quotes in your first attempt, like this: 您只需在第一次尝试中使用引号,例如:
$("input[id^='TOEFLtestDate-']").not("[id$='-0']")
Or a bit cleaner, use the :not()
selector , like this: 或者更干净一点,使用:not()
选择器 ,如下所示:
$("input[id^='TOEFLtestDate-']:not([id$='-0'])")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.