$("#elm")[0].type – arunes Feb 29 '12 at 7:21 @arunes. The elements object (array) allows you to access any element within a form generically, via a loop for example. Here is the HTML form: The JavaScript function can be hundreds of lines of code. I need a way to determine the type of an HTML element in JavaScript. HTML forms can be several elements long with several options when you dynamically create and remove elements. This interface also inherits properties from its parent, HTMLElement. Each element inside the form is stored as an array element inside elements[]. Looping through elements allows for easy checks of empty values, names, element types and other properties and values specific to element types. Also javascript .type property gives the global type of element. In order to access the form element, we can use the method getElementById() like this: The special thing about FormData is that network methods, such as fetch, can accept a FormData object as a body. The second form is almost identical to the first, with two key differences: the element has a different ID, output, and it does not include a ''Submit'' button, as it does not need one. Viewed 142k times 56. It’s encoded and sent out with Content-Type: multipart/form-data.. From the server point of view, that looks like a usual form submission. The