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: 2020-03-03T10:29:05+05:30

233 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements