Easy Tutorial
❮ Prop Style Borderimagesource Jsref Link ❯

Submit form Attribute


Definition and Usage

The form attribute returns a reference to the form that contains the submit button.

If successful, this attribute returns a form object.

Syntax


Browser Support

All major browsers support the form attribute.


Example

Example

The following example will return the ID of the form to which the submit button belongs:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function displayResult(){
    var x=document.getElementById("submit1").form.id;
    alert(x);
}
</script>
</head>
<body>

<form id="form1">
Email: <input type="text" id="email">
<input type="submit" id="submit1">
</form>
<button type="button" onclick="displayResult()">Display Form ID</button>

</body>
</html>

❮ Prop Style Borderimagesource Jsref Link ❯