<form> stuggling with <input>

Hi all

Everything was going great until I got to the form bit! :frowning:

Would someone be able to tell me what id, type, value, and name all do and how they relate to each other?

Thank you

  • Curtis

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

1 Like

I’d like to see your code so we can help you better.

1 Like

see HTML Form Elements and HTML Input Attributes

  • id and also class are identifiers that can be used to do things programatically with the elements. You’d use them in CSS , JQuery, XPATH, etc. to select a specific element and do something with it.

  • name is just kind of a label for the element which you could use to reference an input element in a JavaScript.

  • value is the value of the input data like an email address, phone number, the letter, number, word, or phrase of a multiple choice selection (as for checkboxes or radio buttons).

It is what gets submitted to the action page, or server when the Submit button is clicked in an HTML form . You’d use languages like PHP, Python/Django, JavaScript, etc., to assign the data to variables and do something with it like post it to a database or do some calculation or whatever.

  • type specifies what type of input element it is: text for a text input like First Name, Last Name, radio buttons (single selection), checkboxes (multiple input selection), etc ( see HTML Input Types )

They are all attributes of an input tag.

There are many more types of form and input tags/elements, and attributes. Too many to get into here.

This is a brief overview, there’s tons of info online you can lookup. I’ve provided a few links for you as a starting point.

1 Like

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