Click here to Skip to main content
12,505,335 members (70,497 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# jQuery HTML5
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:56pm
Updated 17-Jan-13 2:17am
v3
Comments
Sanjeev Alamuri 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 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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2016
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