
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Input FileUpload name Property
The HTML DOM FileUpload name property returns and modify the value of the name attribute of an fileupload input type in HTML.
Syntax
Following is the syntax −
1. Returning name
object.name
2. Setting name
object.name=”text”
Example
Let us see an example of FileUpload name property −
<!DOCTYPE html> <html> <head> <title>HTML DOM name Property</title> <style> body{ background-color:#397367; color:#fff; padding:20px; } .btn{ display:block; background-color:#22223B; color:#fff; border:none; padding:0.5rem; border-radius:50px; width:80%; margin:10px; } .show-name{ font-weight:bold; font-size:1.4rem; color:#fff; } </style> </head> <body> <h1>FileUpload name Property Example</h1> <input type="file" name="My_Name"> <button onclick="setName()" class="btn">Click to change Name attribute value of choose file input</button> <div class="show-name"></div> <script> function setName() { var chooseFileBtn= document.querySelector("input"); document.querySelector(".show-name").innerHTML ="Previous Name = " + chooseFileBtn.name + ""; chooseFileBtn.name = "My_New_Name"; document.querySelector(".show-name").innerHTML +="New Name = " + chooseFileBtn.name + ""; } </script> </body> </html>
Output
This will produce the following output −
Following is the “Inspect Element” −
Click on the “blue” button to change the value of the name attribute of the fileupload input type −
“Inspect Element” displays the following −
- Related Articles
- HTML DOM Input FileUpload disabled Property
- HTML DOM Input FileUpload files Property
- HTML DOM Input FileUpload form Property
- HTML DOM Input FileUpload value Property
- HTML DOM Input FileUpload required Property
- HTML DOM Input FileUpload type Property
- HTML DOM Input FileUpload accept Property
- HTML DOM Input FileUpload autofocus Property
- HTML DOM Input FileUpload Object
- HTML DOM Input URL name Property
- HTML DOM Input Week name Property
- HTML DOM Input Password name Property
- HTML DOM Input Reset name property
- HTML DOM Input Search name Property
- HTML DOM Input Submit name property

Advertisements