Obtain element 1 based on attributes. for example, to obtain the element $ ("p [id]" ).css ("color", "red") with an id property in the p tag of the page, obtain element 1 based on the property value. $. In jQuery $ ("<span>"), this syntax is equivalent to $ (document. createElement ("span"), which is a usage. when selecting an element, [attribute $ = value], matches the given attribute with elements ending with some values. The following example shows the HTML code <input name = "newsletter"/> <input name = "milkman"/> <input name = "jobletter"/> jQuery code: $ ("input [name $ = 'Letter ']") Result: [<input name = "newsletter"/>, <input name = "jobletter"/>] 2 .!. Selector: [attribute! = Value]: matches all elements that do not contain the specified attribute or that are not equal to the specified value. This selector is equivalent to not ([attr = value]). Example: HTML code <input type = "checkbox" name = "newsletter" value = "Hot Fuzz"/> <input type = "checkbox" name = "newsletter" value = "Cold Fusion" /> <input type = "checkbox" name = "accept" value = "edevil Plans"/> jQuery code: $ ("input [name! = 'Newsletter'] "). attr ("checked", true); Result: [<input type = "checkbox" name = "accept" value = "edevil Plans" checked = "true"/>] 3. *. Selector: [attribute * = value]. matching a given attribute is an element that contains some values. The following is an example of the HTML code: www.2cto.com <input name = "man-news"/> <input name = "milkman"/> <input name = "letterman2"/> <input name = "newmilk"/> jQuery code: $ ("input [name * = 'man']") Result: [<input name = "man-news"/>, <input name = "milkman"/>, <input name = "letterman2"/>] 4. @. Matches the element that contains the given attribute. Note: In jQuery 1.3, the leading @ symbol has been abolished! To be compatible with the latest version, simply remove the @ symbol. 5. ^. Selector: [attribute ^ = value]. matching a given attribute is an element starting with some values. The following example shows the HTML code: <input name = "newsletter"/> <input name = "milkman"/> <input name = "newsboy"/> jQuery code: $ ("input [name ^ = 'News']") Result: [<input name = "newsletter"/>, <input name = "newsboy"/>] 6. Obtain the HTML code of the element with the specified attribute and the specified string in the set value: <input type = "checkbox" name = "newsletter" value = "Hot Fuzz"/> <input type = "checkbox" name = "newsletter" value = "Cold Fusion"/> <input type = "checkbox" name = "accept" value = "edevil Plans"/> jQuery code: $ ("input [name $ = 'Letter '] [value $ = 'zz']"). attr ("checked", "true"); supports multi-condition operations. Of course, you can also obtain them based on the id attribute or other attributes, for example, $ ("input [id = id1]" ).css ("color", red); In jquery, $ ("input [name = 'metaid ']") is used. val () cannot directly obtain the selected radio value, but only obtain the first value of the radio tag. This may be related to jquery's search using the xpath language, we usually want to obtain the selected radio value. There are several methods: 1. Use $ ("input [name = 'metaid ']: checked "). val () Get // name represents name 2 in radio, use $ (": radio: checked "). val () Get // restrict only one set of radio tags on the page