Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am able to append div tag dynamically, like

function (json) {
for (var i = 0; i < json.length ; i++) {
//alert(json[i].name);
var divTag = document.createElement('div');
divTag.setAttribute('id', json[i].name);
$('
').appendTo("#splitter");
}
}

Now,I want to use the "div" which is created inside the for loop like $("#divTagName").kendoGrid({ }); how can i write in place of "divTagName"
Posted

1 solution

You can not.
document.createElement('div');
creates element in memory to use it in jQuery you must append it to HTML:

JavaScript
$('body').append(div);


Unless you want to that in
$('
').appendTo("#splitter");

then you can just do:

$(div).appendTo("#splitter");


Then just select it by its id.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900