in javascript programming language 4 th video why do we use id=“para1” in html code?
Hi!
In that HTML code former paragraph tag has id “para1” which hasn’t been used anywhere, so in this case it’s of no use. You can remove it also. The webpage will work fine.
@rachit.s.garg The id field is used to uniquely identify a web element. It can be useful for changing its content and other functionality.
If the id is not being used anywhere is the JS code, you can remove it.
yes i know that what is the use of id but is there any logic behind using para1 as a id . because i dont find any use of it!!!
@rachit.s.garg You can change the id to your preference. However, you will also need to change the same in your JS code if applicable.
The id attribute specifies a unique id(identification) for an HTML element.
In JavaScript to manipulate the Particuler HTML element we use the specific id which is mentioned in the HTML.
id specifies a unique id for an HTML element
id value can be used by css and JavaScript to perform certain tasks for the element with the specific id value.
You can modify the content in that
tag