I can't seem to get this to work, it is probably pretty simple but here we go:
This is my selector and I want to look for an element with both the selection[0] and selection[1] class but this does not look for an element that has both. As far as I can tell it only grabs the first selection class and looks for that.
$(this).not("." + selection[0], "." + selection[1]).hide();
I've tried manually inputting it like this and it works:
$(this).not(".class1.class2").hide();
I'm guessing the comma seperates the selectors and it is going wrong there. How can I achieve the same functionality though?
用+
代替逗号,
以将dot [0]连接起来.
$(this).not("." + selection[0] + "." + selection[1]).hide();
This line
$(this).not("." + selection[0], "." + selection[1]).hide();
has a syntax error (not from JS point of view but jquery selector point of view)
make it
$(this).not("." + selection[0] + "." + selection[1]).hide(); //replaced comma with +
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.