How to set the name of the element in HTML?


Use the name attribute to set the name of the element. You can use this with the following HTML elements: <button>, <fieldset>, <form>, <iframe>, <input>, <map>, <meta>, <object>, <output>, <param>, <select>, <textarea>

Example

You can try to run the following code to implement name attribute −

<!DOCTYPE html>
<html>
   <body>

      Subject: <input type = "text" name = "sub" spellcheck = "true">
      <p>Add an incorrect spelling for a word above and see what happens.</p>

      <p contenteditable = "true" spellcheck = "true">This is an editable conttent, with a spelling mistake. Click to edit.</p>

   </body>
</html>

Updated on: 03-Mar-2020

175 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements