Get the element according to the attribute value 1.$. In jQuery, $(""), this syntax is equivalent to $(document.createElement("span")). This is a usage, and it is also used like this when selecting elements: [attribute$ =value], matches elements whose given attribute ends with some value. Let’s take an example to illustrate: HTML code
2 .!. Selector: [attribute!=value], matches all elements that do not contain the specified attribute, or the attribute is not equal to a specific value. This selector is equivalent to: not ([attr=value]). Example: HTML code
4.@. Matches elements containing the given attribute. Note that in jQuery 1.3, the leading @ symbol has been deprecated! If you want to be compatible with the latest version, simply remove the @ symbol .
5.^. Selector: [attribute^=value], matches elements whose given attributes start with certain values. Here is an example to illustrate: HTML code:
Of course, it can also be obtained based on the id attribute or other attributes, such as $("input[id=id1]" ).css("color",red); In jquery, when using $("input[name='metaId']").val() you cannot directly get the value of the selected radio, you just get the radio The first value of the label, this may be related to jquery using the xpath language for search, and we usually want to get the value of the selected radio. There are the following methods: 1, use $(”input[name= 'metaId']:checked").val() to obtain //name represents the name attribute name in radio 2, use $(":radio:checked").val() to obtain //limit the page to only one set of radios Label
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn