Reputation: 10850
I have a table with multiple rows and tds. Of the table I would like to select two td's of different rows having classes invalid-case-sensitive-value, invalid-sentence-scope-value
Is it possible to achieve those in single statement using find()
or any other function.
Something like:
var errorRows = $("topic-table").find("td.invalid-case-sensitive-value", "td.invalid-sentence-scope-value");
Upvotes: 0
Views: 448
Reputation: 14873
Just use the mulitple selector: link
Docu:
Description: Selects the combined results of all the specified selectors.
You can specify any number of selectors to combine into a single result. This multiple expression combinator is an efficient way to select disparate elements. The order of the DOM elements in the returned jQuery object may not be identical, as they will be in document order. An alternative to this combinator is the .add() method.
Sample:
<!DOCTYPE html>
<html>
<head>
<style>
div,span,p {
width: 126px;
height: 60px;
float:left;
padding: 3px;
margin: 2px;
background-color: #EEEEEE;
font-size:14px;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div>div</div>
<p class="myClass">p class="myClass"</p>
<p class="notMyClass">p class="notMyClass"</p>
<span>span</span>
<script>$("div,span,p.myClass").css("border","3px solid red");</script>
</body>
</html>
Upvotes: 3