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?
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);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With