I am trying to add the jQueryUI datepicker on a certain group of datefields, but exclude fields whose id ends in -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 o开发者_运维技巧f 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.
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:
$("input[id^='TOEFLtestDate-']:not([id$='-0'])")
加载中,请稍侯......
精彩评论