KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have selected a bunch of li elements that meet a certain criteria like so: var x = $('li[attribute="value"]'); Now rather than searching the dom again, I want to search x for an li tag that has a specific id. I could use a .each to search x but was wondering if there was a one line statement I could use. something like this: var myLi = x.find("[id=23]"); or is it faster to search the dom using the id tag. What if I wanted to search on a second attribute? Please advise. Thanks! Edit Please note that I want to change the properties of myLi (say make its background color red) so I need a ref to the element. thanks.
Tags (comma-separated)
Save Edits
Cancel