I am using javascript to add element dynamically. Here count is defined and increasing by one
<span style="margin-left:10px;">File Type : <select name="select_type_'+count+'" >
<option value="select">Select</option></span>
I using an another javascript function to get the value of select_type_'+count+' by using
var temp=parseInt((document.submission.select_type_+i.value));
alert(temp);
here var i
is defined and incrementing
but i am getting NaN
value .how to solve this?thanks in advance
Try this instead:
var temp=parseInt((document.submission['select_type_'+i].value));
alert(temp);
The JavaScript parser interprets your original code as document.submission.select_type
plus i.value
. Since neither document.submission.select_type
nor i.value
are defined, you're getting NaN
from parseInt
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.