and [object HTMLInputElement] javascript
This code written as it is in a simple page generates an [object] as I needed.
function jsFunction(){
var arr=document.all("camp");
alert(arr);
}
HTML:
<开发者_JS百科;input name="ctl00$MainContent$_basicDataControl$_winProbabilityPopUpControl$_winProbabilityControl$_groupWinProbabilityQuestions$ctl00$_groupPercentage" type="text" id="camp" class="readonly2" readonly="readonly"/>
<input name="ctl00$MainContent$_basicDataControl$_winProbabilityPopUpControl$_winProbabilityControl$_groupWinProbabilityQuestions$ctl01$_groupPercentage" type="text" id="camp" class="readonly2" readonly="readonly"/>
<input type="button" value="apasa aici!" onClick="jsFunction()">
In another page this code written with others inputs and included in a form returns an [object HTMLInputElement]
and I can't parse the array. What could be the problem?
as specified in my comment above, an id must be unique in page.
so you should retrieve a collection of input instead (e.g. document.getElementsByTagName('input')
and exclude last element (is the submit))
or in jQuery $('input[type=text]')
obviously you need to call that function after the elements are created
精彩评论