MadCom
MadCom

Reputation: 241

How to get form id with js?

How to get a form element's id using JavaScript, when you have the form object.

Using form.id would be good, but if the form has an <input id="id"> it returns that input object instead of the id of the form element.

Upvotes: 0

Views: 3666

Answers (1)

Subir Kumar Sao
Subir Kumar Sao

Reputation: 8401

You can use getAttribute("id"); to get the id of the form.

Upvotes: 5

Related Questions