Get and set the position with jQuery .offset ()


How to get and set the position of an element with the jQuery .offset method?

Let's say I have a div layer1 and another layer2. How can I get the position of layer1 and set the same position to layer2?

var p = $("#elementId");
var offset = p.offset();

$("#secondElementId").offset({ top:, left: offset.left});