| Start |
|---|
| Differece between attr() and prop()
To set a checkbox as checked: To remove a property you can use the |
| Get the attribute value of a HTML element When a single parameter is passed to the Syntax:
Example: HTML:
jQuery:
Fetching jQuery offers Syntax:
Example: Html:
jQuery:
Note: jQuery's data() method will give you access to data-* attributes, BUT, it clobbers the case of the attribute name. Reference (opens new window) |
| Setting value of HTML attribute If you want to add an attribute to some element you can use the This example will add mouseover text The same function is used to change attributes' values. |
| Removing attribute To remove an attribute from an element you can use the function This will remove RemarksThe jQuery function It is worth noting that when getting the value of an attribute, it only gets it from the first element that matches the selector (i.e. However, when setting an attribute, it will apply it to all matching elements. |
Read Article
https://develop.horje.com/learn/1434/reference