Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# jQuery HTML5/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 17-Jan-13 0:56am
Edited 17-Jan-13 3:17am
v3
Comments
Sanjeev Alamuri at 17-Jan-13 5:59am
   
please paste your code.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 at 17-Jan-13 8:18am
   
sorry i posted mistakenly,dynamically set the div position while getting the values from database using jquery
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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 at 17-Jan-13 8:15am
   
sorry i posted mistakenly,dynamically set the div position while getting the values from database using jquery

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

  Print Answers RSS
0 OriginalGriff 7,215
1 DamithSL 5,114
2 Maciej Los 4,866
3 Sergey Alexandrovich Kryukov 4,747
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 17 Jan 2013
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