Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Updated 17-Jan-13 2:17am
v3
Comments
Sanjeev Alamuri 17-Jan-13 5:59am    
please paste your code.

Hi,

see the best and simple method to create a div might be like below:

C#
      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.
 
Share this answer
 
Comments
keerthana.k 17-Jan-13 8:18am    
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
 
Share this answer
 
Comments
keerthana.k 17-Jan-13 8:15am    
sorry i posted mistakenly,dynamically set the div position while getting the values from database using jquery
[no name] 17-Jan-13 8:39am    
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)



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