Latest web development tutorials
 

Button form Property

< Button Object

Example

Return the id of the form the button belongs to:

var x = document.getElementById("myBtn").form.id;

The result of x will be:

myForm
Try it Yourself »

Definition and Usage

The form property returns a reference to the form containing the button.

The form property returns a form object on success.

Note: This property is read only.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The form property is supported in all major browsers.


Syntax

buttonObject.form

Technical Details

Return Value: A reference to the form element containing the button. If the button is not in a form, null is returned

< Button Object