jQuery – Multiple Attribute Selector [name="value"][name2="value2"]

The jQuery multiple attribute selector matches elements that match all of the specified attribute filters.

Source Code

<!DOCTYPE html>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
<h4 id="id1" name="1text">Text 1</h4>
<h4 id="id2" name="2text">Text 2</h4>
<h4 id="id3" name="3text" >Text 3</h4>
<button>Click Here</button>

jQuery("button").click(function () {
	jQuery('h4[id="id3"][name$="text"]').css({border:"3px #1E8CBE solid"});


Following example finds all inputs that have an id attribute is equal to “id3″ and whose name attribute ends with “text” and sets the border.

Text 1

Text 2

Text 3


No comments yet.

Leave a Reply