I am working on web app and I need to display data coming from the server which is in json format in tiles. I have made group of four tiles which represents one event i.e. each tile represents different parameter of the same event. Now the number of events coming from the server is dynamic as the server keeps updating. So I need to write code for creating this set of four tiles dynamically, so that on click of a button if on server let number of events be 10, I should have 10 set of these four tiles. Also I need to display it on same page so that on swipe(either right or left), I will get one set of event at a time. Here is the part of my code: http://jsfiddle.net/archana85/n6sunk1r/1/
I searched on net I tried with document.createElement. Part of my code is:
$(document).ready(function() {
$('#milk').click(function() {
var iCnt = 0;
// CREATE A "DIV" ELEMENT AND DESIGN IT USING JQUERY ".css()" CLASS.
var container = $(document.createElement('div'))
});
if (iCnt <= myJSON.length) {
// ADD BOX.
$(container).append('<input type=text class="input" id=tb' + iCnt + ' ' + 'value="Text Element ' + iCnt + '" />');
Now I am not getting here how should I add boxes as each box has three different fields and each field have different id's. My code is in javascript and jquery. Thanks in advance.