I have a function:
jQuery(function($) {
var scntDiv = $('#textfields');
var i = $('#textfields p').size() + 2;
var a = 0;
$('#addbutton').click (function() {
$('<p><input type="text" id="test_testbutton" name="test_testbutton[a][0]" value="" placeholder="Input Value" /><input type="text" id="test_testbutton" name="test_testbutton[a][1]" value="" placeholder="Input Value" /><a href="#" id="removebutton">Remove</a></p>').appendTo(scntDiv);
i++;
a++;
return false;
});
$('#removebutton').live('click',function() {
if( i > 2 ) {
$(this).parents('p').remove();
i--;
}
return false;
});
});
And what I'd like to achieve is to make 'test_testbutton[a][0]' a 'test_testbutton[0][0], test_testbutton[1][0], test_testbutton[2][0]...etc' with every iteration. You may laugh, but I'm seraching for any info about it since today morning and I couldn't find the exact example. When I "console.log" the variable everything works perfectly, but I don't know how to put a variable inside HTML...