Click here to Skip to main content
Sign Up to vote bad
good
See more: C#jQueryHTML5/CSS
hi friends
i have a div in the page and divid,top,left,height,width values are stored in database.if i am getting the values from data base, the values are get but the div not to be fix using jquery. dynamically set the div position from database using jquery. i am newbie this. any body help me.thanks a lot.
Posted 16 Jan '13 - 23:56
Edited 17 Jan '13 - 2:17

Comments
Sanjeev Alamuri - 17 Jan '13 - 5:59
please paste your code.

2 solutions

Hi,
 
see the best and simple method to create a div might be like below:
 
      function createDiv(obj1, obj2, obj3, obj4) {
           var newDiv = '<div id="test1" style="height:'+obj1+';width:'+obj2+';color:'+obj3+';">rakesh</div>'
            $('#obj4').append(newDiv);
 

}
 

here i have passed the four paremeters which are height,width,color and another div or page id where i have to add this newly created div.
 
i hope it might help.
  Permalink  
Comments
keerthana.k - 17 Jan '13 - 8:18
sorry i posted mistakenly,dynamically set the div position while getting the values from database using jquery
HI,
 
You can use some thing like :
 
$(document).ready(function() {
    $('#imgBtnAddNewLineItem').click(function() {
        $('#container').append('<div></div>');
    });
});
 
Here I am sharing some links that can help you.
Add Div Dynamically using JQuery
using jquery to dynamically create div
Dynamically adding DIV using jQuery
 
Thanks
  Permalink  
Comments
keerthana.k - 17 Jan '13 - 8:15
sorry i posted mistakenly,dynamically set the div position while getting the values from database using jquery
sisir patro - 17 Jan '13 - 8:39
Yes you can call the javascript function which will add the div from code behind.

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 508
1 Arun Vasu 275
2 Maciej Los 228
3 OriginalGriff 215
4 Rohan Leuva 176
0 Sergey Alexandrovich Kryukov 9,670
1 OriginalGriff 7,409
2 CPallini 3,968
3 Rohan Leuva 3,352
4 Maciej Los 2,861


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid