I'm a JQuery Newbie. I'm trying to append an object property( declared in an array form) to an html element like the following
HTML:
<div id="container">
<p>some text </p>
<p>some text </p>
<p>some text </p>
</div>
JQuery Script:
var obj{
property : {'apple', 'orange', 'banana'}
}
for(i=0; i<=2; i++){
$("#container p:eq("+i+")").append(obj.property[i]);
}
and hope to get this:
<p>some text apple</p>
<p>some text orange</p>
<p>some text banana</p>
There are no appending shown at all, though my Firebug console shows no error report.
What am I doing wrong? Also, is there any way to replace the for loop with .each(), if it's a better practice?
Thank you