What is the Id attribute for?

Hi. I’m doing my first Web design lesson where I need to create a radio button. I need to add an id attribute to it which I did but I don’t quite understand its purpose. I googled it and it says that it is a unique identifier. But it does not make the specified text bold or italic like or . So what is it for? I don’t understand its purpose even when I see examples with the Outputs just because I don’t understand what exactly was supposed to change with the addition of this attribute.

the id is a way to uniquely identify an element.

This can be used for styling, or to select the element with JavaScript.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.