I need to get the var i
need to be appended to the left side of the object declaration. I am unable to find how to append that. Kindly help me to get rid of the Error.
If any Other Solution available also i will follow it up.
I have tried the below code
<script type="text/javascript">
var text_count=5;
var textbox = new Object();
for (var i = 1; i<=text_count; i++)
{
textbox.meta_key_textbox='Meta Key';
textbox.meta_key_value_textbox='Meta Value';
};
var textbox_string = JSON.stringify(textbox);
alert(textbox_string);
</script>
I get the last Value alone in this. But I am unable to get all the Values that are in the Loop.
But when i do this method manually it works. Kindly Clarify on this.
<script type="text/javascript">
var text_count=5;
var textbox = new Object();
textbox.meta_key_textbox='Meta Key';
textbox.meta_key_value_textbox='Meta Value';
textbox.meta_key_textbox1='Meta Key One';
textbox.meta_key_value_textbox1='Meta Value One';
var textbox_string = JSON.stringify(textbox);
alert(textbox_string);
</script>