Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript ASP:NET
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 14-Nov-12 1:18am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can not.
document.createElement('div');
creates element in memory to use it in jQuery you must append it to HTML:
 
$('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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 525
1 CPallini 505
2 George Jonsson 353
3 OriginalGriff 220
4 Pheonyx 218
0 OriginalGriff 4,813
1 CPallini 3,890
2 Sergey Alexandrovich Kryukov 3,274
3 George Jonsson 2,552
4 Gihan Liyanage 2,186


Advertise | Privacy | Mobile
Web02 | 2.8.140905.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100