开发者

Jquery element creation on the fly

I am processing a JSON file and want to display the contents in a <div> i dont know the number of records of the json file so i want to create teh appropriate divs on the fly. how should i go about it?

the structure i am looking at is: <div class=1> <div class=2> 开发者_Python百科 <div class=3> </div></div></div>


var div = $('<div/>') will create an empty div, in which you can insert your data, and ultimately insert it into the DOM


Use $.each to loop through your JSON data as seen in this example from the docs

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜