I am appending a block with jQuery dynamically but when I post the form, the last appended block is not getting posted?
my problem is when the last block is appended with loop…it post all other blocks but not read the last one…for example if 5 block is added but it posts only till fourth block.
here is my some of code
limit = $("#conditions1").find('option').length-2;
if( limit >= counter ) {
counter++;
var a = $("#dynamic").html();
var cond = "conditions"+counter;
var cond_val = "conditions_value"+counter;
var cond_no = "Condition"+counter;
var tr1 = "tr_first"+counter;
var tr2 = "tr_second"+counter;
var sub_cond_val = "sub_conditions_value"+counter;
$("#dynamic_id").html(a);
$("#dynamic_id").find('#condition_no').text(cond_no);
$("#dynamic_id").find('#tr_first').attr('id',tr1);
$("#dynamic_id").find('#tr_second').attr('id',tr2);
$("#dynamic_id").find('#conditions').attr('name',cond);
$("#dynamic_id").find('#conditions').attr('id',cond);
$("#dynamic_id").find('#conditions_value').attr('name',cond_val);
$("#dynamic_id").find('#conditions_value').attr('id',cond_val);
$("#dynamic_id").find('#sub_conditions_value').attr('name',sub_cond_val);
$("#dynamic_id").find('#sub_conditions_value').attr('id',sub_cond_val);
var b = $("#dynamic_id").html();
$("#dynamic_conditions").append(b);
$("#dynamic_conditions").show();
Hello if anybody is looking for this type of problem..then answer is
The block(say a) which with you are appending in the other block(say b) you should empty that “a” block again after appending that “b” block ….you can that by $(“#a”).empty()