+ 4
HTML What does this question means?
Single quotes can be used around attribute values fi the attribute value contains double quotes or vice versa. and what is id attribute ? what is event attribute?
3 Answers
+ 31
https://www.w3schools.com/tags/ref_eventattributes.asp
https://www.w3schools.com/tags/att_global_id.asp
UseĀ idĀ attributes whenever you need to address a particular HTML element with CSS, JavaScript orĀ a fragment identifier. It's possible to look up elements by name, too, but it'sĀ simpler and more reliableĀ to look them up by ID.
+ 3
id attribute :
id attribute uniquely represents an element. The element represented can be accessed via CSS or JS , to perform specific editing on the element. for example :-
css :
#name {
color: red;
}
This css code block access an element with an id name (that is - <div id="name">ā¦</div>)and changes its color to red.
JS :
var a= document. getElementById("name");
This JS code block also access an element with an id name (that is - <div id="name">ā¦</div>).
Event attributes :
an event attribute specifies what should happen when a particular event occurs, by event we mean any action such as clicking an element or placing the mouse on that element etc.
Please note that -
Example :
<div onclick=" alert('Hello') "></div>
Here onClick ( meaning - on click ) is an event attribute and the event or action is clicking the element.
This div element when clicked will show a prompt message "Hello".
I am sorry for the complex language. I hope its quite clear thanks.
+ 2
@Elizabeth it is only for event attribute!