I had such js code it was running with jQuery 1.7.1
$("(.editor-field .input-field):has(input[data-val-required])").each(function () {
$(this).prev().find("label").append("<strong style='color:#ff0000'>*</strong>")
})
But now i changed to jQuery 1.10.2
and having problems with it. Getting an error message:
Uncaught Error: Syntax error, unrecognized expression: (.editor-field .input-field):has(input[data-val-required]) jquery-1.10.2.js:1850
Is there any chance to fix that?
The first set of parentheses are not necessary. Just remove them.
This should do what you want:
$(".editor-field .input-field:has(input[data-val-required])")
That is assuming you want the has
part to only apply to the .input-field
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.