Error: uncaught exception: Syntax error, unrecognized expression: inputnum
I've inherited another developer's code for a project I'm working on. Here's an开发者_高级运维 example of their code - notice the first comment...
function disableSuggestButton(themePath) {
// could not see a better way of doing this :(
var row = $("input[type='text']:inputnum:inputnumsmall");
$(row).each(function () {
if ($(this).attr("disabled") == true) {
var btn = $(this).closest("tr").find(".btnSuggest")
$(btn).hover(function () {
$(this).css({ backgroundImage: 'url(' + themePath + '/images/buttons/btnSuggest.png)' }).css('cursor', 'default');
}, function () {
$(this).css({ backgroundImage: 'url(' + themePath + '/images/buttons/btnSuggest.png)' }).css('cursor', 'default');
});
$(btn).removeAttr("title").removeAttr("href");
}
});
}
I needed to upgrade the version of jQuery (from 1.3.2 to 1.4) however when doing this the following line:
var row = $("input[type='text']:inputnum:inputnumsmall");
produces the following error:
Error: uncaught exception: Syntax error, unrecognized expression: inputnum
How can I improve on the previous devloper's selector? inputnum & inputnumsmall are CSS classes.
Thanks
Had the previous developers written some custom selectors? (maybe right into the jquery file?).
You should just be able to do:
var row = $("input[type='text'].inputnum.inputnumsmall");
Example: http://jsfiddle.net/BqHBf/
精彩评论