I am new with Jquery touch. This code will add a text fields for a mobile survey question. I don't have any idea on how to get the index and value so that I can save it to my wamp server.
$(function(){
var i = 0;
var ii= 0;
var newID = "quest_no_"+i;
var newChoice = "choice"+i;
$('#add_quest').tap(function(){
i++;
$('#'+newID+'').parent().before('<li><input id="quest_no_'+i+'" name="quest_no_'+i+'" type="text" value="'+i+'. " /><ul class="rounded"><li><input id="choice'+i+'" type="text" placeholder="Choice" onmousedown="mouseDown()"/></li></ul></li>');
}),
$('#btn_done').tap(function(){
var setText = document.getElementById('add_choice_opt').value;
//var setType = document.getElementById('txt_type').value;
var getType = document.getElementById('txt_type');
var setType = getType.options[getType.selectedIndex].text;
var newChId = i + "_" + ii;
ii++;
//var ind_val = setText+ "--" + newChId;
if(setType == 'Checkbox'){
$('#choice'+i+'').parent().before('<li><input id="'+newChId+'" type="checkbox" name="choice'+i+'" title="'+ setText +'" /></li>');
}
else{
$('#choice'+i+'').parent().before('<li><input id="'+newChId+'" type="radio" name="choice'+i+'" title="'+ setText +'" /></li>');
}
//$('#choice'+i+'').parent().before('<li><input id="choice'+i+'" type="text" placeholder="Choice'+i+'" value="'+ setText +'"/></li>');
location.href="#createSurvey";
})
});
</script>