Andrew Hoskins4,888 Points
the purposes behind using: "value", "id", "name", and "for" ?
Hello, I am having trouble fully understanding the purposes behind using: "value", "id", "name", and "for"
Chris Shaw26,618 Points
I'll jump straight in.
valueattribute is for the input fields data value, when the form gets posted through to a backend language such as PHP; the value can be extracted to perform additional tasks if needed
forattribute on a label
nameattribute is the most important on a form element, without it a - backend language wouldn't have any idea that it ever existed thus no value for it would ever been seen
forattribute is important to label element's, as I said earlier this allows you to target the
idattribute of the form field which is great for accessibility and it provides a way for the user to visually see where they are if they can only navigate using a keyboard as well as when they're using a screen reader.
idan ben yair10,288 Points
Hi Andrew try reading here a little bit:
w3.org has a lot of info on it! it's great I use it a lot when I cant understand something.
Let me know if that helped :)