javascript - Is it possible to get all elements which have a specific value into any type of attribute? -


i want elements in html dom, have attribute specific value.

for example -

<ul style="width:150px;" id="radiobutton1">    <li style="width:150px;"><input type="radio" name="radiobutton1"><label>option 1</label></li>    <li style="width:150px;"><input type="radio" name="radiobutton1"><label>option 2</label></li>        <li style="width:150px;"><input type="radio" name="radiobutton1"><label>option 3</label> </li> </ul> 

i want elements contains "radiobutton1" in attribute. means want select ul , 3 radiobuttons.

note: above html used ul-li structure, real scenario it's different. please don't give answer in favor of ul-li. want global solution.

there selector exist select type of attribute?

is possible select elements in approach?

bunch of in advance...!!!

it can done filtering each element , checking attributes:

fiddle

var elements = $('*').filter(function () {     return $(this.attributes).filter(function(){         return this.nodevalue == 'radiobutton1';      }).length; }); 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -