-
Notifications
You must be signed in to change notification settings - Fork 0
#24 π JavaScript DOM Set and GET Attributes
Adarsh Tripathi edited this page Aug 6, 2021
·
2 revisions
*****************************Tutorial Start π₯ ********************************
<a href="http://linkedin.com">Linkedin</a>
Yaha <a> jo hai voo aik tag hai html me ,
href , jo hai voo aik attribute hai html me,
"https://www.linkedin.com" , "" double quotes ke andar voo aik value hai
<img src="abc.png" alt="">
Yaha <img> jo hai voo aik tag hai html me ,
src , jo hai voo aik attribute hai html me,
"abc.png" , "" double quotes ke andar voo aik value hai
alt, jo hai voo aik attibutes hai html me,
"", double quotes ke andar voo aik value hai
<h2 id="heading">javaScript Tutorial</h2>
Yaha <h2> jo hai voo aik tag hai html me ,
id , jo hai voo aik attribute hai html me,
"heading" , "" double quotes ke andar voo aik value hai
Inline style jo hai voo bhi aik attributes hai html me
Value=getAttribute(attribute)
- Yaha attribute muzea parameter me dena hai and value humko return me milegi.
setAttribute("attr", "value")
- yaha pe attribute batana hai and value set karna hai comma , laga ke.
<a id="siteUrl" class="link-alert alert-primary" href="http://linkedin.com">Linkedin</a>
<a id="site1Url" href="http://yahoo.com">Yahoo</a>
<button onclick="getAttr()">Get</button>
<button onclick="setAttr()">Set</button>
<button onclick="remAttr()">Remove</button>
***************************** Tutorial End π ********************************
FOllow me on Github