I want us to talk about this input element in a little bit more detail. Yes, we're going to be diving
into a lot more detail later, but we've just created our first input element, and I thought it would
be an appropriate time just to give you a bit more knowledge about it.
Remember our code,
we wrapped everything in a div, and we had a label and an input.
The first thing you might have wondered is why do we have this "name" attribute? And that, my dear students
is a fantastic question.
Conceptually, you can think of an input element as representing a variable that gets sent to the backend
server.
And the 'name' attribute defines the name of this variable.
And the value, of course, is whatever the user has entered into the text field.
OK, okay.
But what do I mean?
Well, let's say the user types in his name and let's say his name is Wally.
Remember that we treat this whole input element, its value, as a variable, and we've named the variable
"name".
I know it's confusing because it's also a name attribute, but the reason we call that name is that
this is the name of the user 😵‍💫.
So we could have called it "firstname", for example,
maybe that would have been more clear.
But anyway, we called it 'name'.
That's the name of our variable.
And when the user inserts his value, call it Wally, that's going to be the value associated with that
variable.
And of course, as we know, it's most likely going to be sent to a web server.
So there we go.
I just wanted a very, very brief discussion just to give you a little bit more knowledge on this input
element.
But we've got a ton more to learn, so let's keep going.