I have no issues with any browser, I just need a method which will return a reference to the input element which is deeply nested in DIV tag, I can iterate over each child nodes, but I don't wanna those loops..
Is there any way, so that I can directly get the INPUT tag/element with name "manufacturerName" ?
The hierarchy is like this, (If my DOM concepts are good enough)
Ok, I used "getElementsByTagName("input") ", and the resulted code as follow:
The alert prints [object], but when I used any property for that object , like 'name' or 'value', its prints undefined..
And one more doubt, the clone elements has two "input" tags, one is "<input type="button" ... />" and second is "<input type="text" .... />", How do I know which one is extracted by method ?
Obviously you will get an undefined element. The getElementsByTagName will return an array of input objects. Try to iterate over the array using for loop (the max length will be inputElement.length). Then you can print the individual elements by using inputElement[counter].value or inputElement[i].name.
And to differentiate between a text box and a button use the type property of the inputElement[counter] object.