Input Button name Attribute

Definition and Usage

name Sets or returns the value of the name attribute of the file upload button.

The HTML name attribute is used to identify form data submitted to the server or to reference form data on the client using JavaScript.

Note:Only form elements with a name attribute will pass their values when submitting the form.

See also:

HTML Reference Manual:HTML <input> name Attribute

Instance

Example 1

Get the name of the file upload button:

var x = document.getElementById("myFile").name;

Try It Yourself

Example 2

Change the name of the file upload button:

document.getElementById("myFile").name = "newFileName";

Try It Yourself

Syntax

Return name attribute:

fileuploadObject.name

Set name attribute:

fileuploadObject.name = name

Attribute Value

Value Description
name Specifies the name of the file upload button.

Technical Details

Return Value: A string value representing the name of the file upload button.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support