This article is a detailed description of how to use jquery's. attr () and. Removeattr () methods to read, add, modify, delete the attributes of the element, not friends can refer to ha, hope to help you all
To share with you today how to use
Today we will share with you how to use jQuery's. attr () and. removeAttr () Methods to read, add, modify, and delete attributes of elements. In normal Web page creation, you have encountered how to dynamically obtain the attributes and attribute
Today I'm going to share with you how to use jquery's. attr () and. Removeattr () methods to read, add, modify, and delete the attributes of an element. Everyone in the usual web page production has encountered how to dynamically get elements of
The difference between the Removeprop () and removeattr () removal attributes of jquery
------------Removeprop () and removeattr () functions are detailed------------------------------
※removeprop () "Use less delete, set the property value to
The attr () method is used in query to get and set element properties, attr is an abbreviation for attribute (attribute), which is often used in jquery DOM operations attr ()attr () has 4 expressions
attr (incoming property name): Gets the
This article mainly introduces the removeAttr () method of jQuery source code interpretation, and analyzes in detail the implementation skills of removeAttr method, which is of great practical value, for more information, see the removeAttr ()
Usage One: $ (selector). attr (property name) Its function is to get the value of the specified property of the specified element (the $ (selector) portion). See Example:
Have such a section of HTML:
So what do you want to get to the address of
attr () method
attr (name): Gets the property value of the first matching element. This method makes it easy to get the value of a property from the first matching element. Returns undefined if the element does not have a corresponding property.
RemoveAttr () method analysis based on jQuery source code, jqueryremoveattr
This article analyzes in detail the removeAttr () method of jQuery source code interpretation. Share it with you for your reference. The specific analysis is as
This article mainly introduces the removeAttr () method usage in jQuery. it analyzes the functions and definitions of the removeAttr () method and the usage tips for removing corresponding attributes from matching elements, for more information
This article mainly introduces the removeAttr () method usage in jQuery. It analyzes the functions and definitions of the removeAttr () method and the usage tips for removing corresponding attributes from matching elements, for more information
Next, let's take a look at the usage of ATTR:
1. ATTR (name): gets the attribute value of the First Matching Element. This method can be used to conveniently obtain the value of an attribute from the First Matching Element. If the element does not
Usage 1: $ (Selector). ATTR (attribute name) is used to obtain the value of a specified attribute of a specified Element ($ (selector.Example: There is such an HTML: What should you do if you want to get the image address? This way: $ ("IMG
Let's take a specific look at the usage of attr:
attr (name): Gets the property value of the first matching element. This method makes it easy to get the value of a property from the first matching element. Returns undefined if the element does not
This paper analyzes the Removeattr () method of jquery source interpretation in detail. Share to everyone for your reference. The specific analysis is as follows:
Ways to extend the jquery prototype object:
Copy Code code as follows:
This article mainly introduces the attr method and removeAttr method usage in JQuery. The example shows how to use the attr method in jQuery to set attributes and the removeAttr method to remove attributes, which is very useful, for more information
Removeattr is much simpler than attr's code. function (name) { returnthis. each (function() { this, name);} ,The Jquery.removeattr method is called internally, so we can just look at it.Removeattr:function(Elem, value)
Next, let's take a look at the usage of attr:1. attr (name): gets the attribute value of the First Matching Element. This method can be used to conveniently obtain the value of an attribute from the First Matching Element. If the element does not
1 each element has one or more attributes that are used to give additional information about the element or its contents, such as: In an IMG element, SRC is the attribute of the element, and the address that marks the image2 main DOM methods for
Example of using the attr method and removeAttr method in JQuery, jqueryattr
This document describes the attr and removeAttr methods in JQuery. Share it with you for your reference. The details are as follows:
I is div1 I am div2
I
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.