I’m creating a survey question that has multiple answers.
There is a button to clone the existing textbox.
however, how do I get the value of those cloned textbox, especially from the codebehind.
Here is my code:
function generateRow() {
if (totalans == 9) {
$('#<%= label2.ClientID %>').html('<b>Maximum of 10 answers per questions reached</b>');
}
else {
$("#ans").clone().prependTo("#ans2");
totalans = totalans + 1;
}
//#ans is a division.
Could anyone help me please.
I tried to get it.
//c# code behind
String bla = tb_ans.ToString();
String[] splitAnswer = bla.Split(',');
int a = splitAnswer.Length;
//tb_ans is my textbox id.
I tried to use an array, but it seems it only took the first textbox value while dumping the others.
After viewing your comment i’ve revised my answer: