Published in : 2022-02-11
I've been learning lately about the "for" attr in HTML and what it accomplishes, but I came across a strange example that I'm still trying to figure out.
I understand why "for" is required in the first block of code, but I'm not sure why "for" and "id" were used implicitly in the second code when it might have worked just fine without them. Is there anyone who can assist me?
<input id="here" type=radio name=here-there><label for="here">Here</label>
<label for="hello"><input id="hello" type=checkbox name=greeting> Hello</label><br><label><input type=checkbox name=greeting> Hello</label>
Join our community and get the chance to solve your code issues & share your opinion with usSign up Now