<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"> <Head> <title>Property Selector</title> <Metahttp-equiv= "Content-type"content= "Text/html;charset=utf-8" /> <styletype= "Text/css">. Yang{Border-collapse:collapse;width:500px;Height:30px;Border:1px solid Red;"} </style> <Scripttype= "Text/javascript"src= "Jquery-1.7.1.min.js"></Script> <Scripttype= "Text/javascript"> /*[attribute]: matches an element with a specified property [Attribute=value]: An element that matches a specified value [Attribute!=value]: An element that matches an attribute value that is not equal to a specified value [attribute ^=value]: The element that matches the value of the attribute to specify the beginning of the value [Attribute$=value]: The element that matches the property value to specify the end of the value [Attribute*=value]: The element that matches the specified value in the property value [Selector1][sel Ector2][selectorn]: Specify multiple match conditions at the same time*/window.onload=function(){ $('#btnOk'). Click (function(){ //match a font with a color attribute and change the content to jquery //$ (' font[color] '). html (' jquery '); //: An element that matches a property to a specified value //$ ("font[color= ' #667788 ']"). HTML (' color '); //An element that matches a property that is not a specified value //$ ("font[color!= ' #667788 ']"). HTML (' color '); //element that matches the value of the attribute to specify the value to begin with //$ ("font[color^= ' #667788 ']"). HTML (' my ');specify multiple match conditions at the same time $ ('Font[size][color]'). HTML ('Yuyjn'); }); }; </Script> </Head> <Body> <Fontsize= "6">Font 1</Font> <HR/> <FontColor= "#336699">Font 2</Font> <HR/> <FontColor= "#667788">Font 3</Font> <HR/> <FontColor= "#338899">Font 4</Font> <HR/> <Fontsize= ' 6 'Color= "#FFAA99">Font 5</Font> <HR/> <HR/> <inputtype= "button"ID= ' Btnok 'value= ' OK '/> </Body></HTML>
jquery Property Selector (matches multiple conditions simultaneously)