Q:

Set position dynamically with jquery

I need to use the offset coordinates of one position to dynamically set the position of a second element ("#test").  
    var p = $("#desired_equity");
    var position = p.offset();

  $(document).ready(function(){
    $('#test').css("left", position.left);
    });

Im not sure what I am ding wrong here, any ideas? 

A:

You're maybe setting var p before DOM for #desired_equity is ready. 
Try
$(document).ready(function(){
    var p = $("#desired_equity");
    var position = p.offset();   
    $('#test').css("left", position.left);
});

