O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Selecting Elements Based on HTML Attributes

$("input[value=0]"); //selects <input> with value="0" $("p[class*=my")//selects elements "my" in classname $("img[src^='icons\\/']");   //selects <img> elements where src starts with "icons/" $("input[value!='default']");   //selects <input> elements where the value is not "default" $("p[id]"); //selects <p> elements that have id set $("p[id][class$=Menu");   //selects <p> elements with idset and   //classname ending with "Menu"

Another way to use jQuery selectors is to select HTML elements by their attribute values. It can be a default attribute or one that you have added to the HTML elements. Attribute values are denoted in the selector syntax by being enclosed in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required