How to get element without element id?

javascript

Solution

you can do this by using :

`getElementsByTagName`

example :

var elements = document.getElementsByTagName('input'); // returns array

for more broader details in using it click here

Problem

``` 1.<input id="kw1"></input> 2.<input></input> ``` The first one, I can use `document.getElementById` to get the object, but on some websites, like the second, there is no id in element, but I also want to get the object. How can I do this ? And do not use JQuery

Original source

Related problems