You can use ,
to separate your selector:
$("table span[title='Excel'], table span[title='2ndValue'], table span[title='3rdValue']");
Question
I need to check title
attribute of a control with multiple values. Means title
of control may be any of some 3 values.
For example :
alert($("table span[title='Excel']").text());
here title
could be PDF
or CSV
too.
So how could we check title
of span
with multiple values using one selector.
for example:
$("table span[title='Excel'] || [title='2ndValue'] || [title='3rdValue']")
Solution
You can use ,
to separate your selector:
$("table span[title='Excel'], table span[title='2ndValue'], table span[title='3rdValue']");
OTHER TIPS
Try using .filter()
in your context,
var title == "";
$("table span[title]").filter(function(){
title = $(this).attr('title');
return title === "title1" || title === "title2" || title === "title3";
});