问题
How can i add more the one variable in JavaScript :
var selector = 'a[href$=png]:has(img)';
So that it can get images with other format like jpg, jpeg and bmp also.
Full script https://googledrive.com/host/0Bx94NfJgN888WWVnNTk5UHhhbk0
回答1:
You can use multiple selectors in the same statement to select anything that matches either of your selectors, like so:
$('.selector1, .selector2')
This will match any element with the class selector1 or selector2. Therefore you could try something like the following:
var selector = 'a[href$=png],a[href$=jpg]';
$(selector)...
来源:https://stackoverflow.com/questions/35731002/how-to-add-more-than-one-selector-in-javascript