0

I´m trying to join two JS that do exactly the same thing but with different jquery selectors:

A:

var names = $('span[name|="name"');
for (var i=0; i < names.length; i++) {
        ...
}

B:

var names = $('span.author a').not('.authlink');
for (var i=0; i < names.length; i++) {
        ...
}

As all the code in the for{} is exactly the same, I´ll want to do

var names = $("A" OR "B");
for (var i=0; i < names.length; i++) {
        ...
}

But can´t make it work

I tried

var names = $('span[name|="name",span.author a').not('.authlink');
var names = $('[span[name|="name"],[span.author a]').not('.authlink');

and several other combinations but was unable to make it work.

Any suggestion?

4b0
  • 21,981
  • 30
  • 95
  • 142

0 Answers0