I would like to move one DIV
element beside another, it is normally like this:
-
You can use insertAfter
to move the element. Docs
$('.price').each(function() {
$(this).insertAfter($(this).parent().find('.name'));
});
Here you have the updated fiddle.
讨论(0)
-
<div>
's are block-level elements so that's their natural behavior. You could float the div's and then clear them, or use display: inline
.
I think this link would help you understand a bit more though:
CSS block and inline
讨论(0)
-
$('.box-related-product-top > div').each(function(){
$(this).find('.image').appendTo(this);
$(this).find('.name').appendTo($(this));
$(this).find('.price').appendTo($(this));
$(this).find('.cart').appendTo($(this));
});
Try it: http://jsfiddle.net/m6djm/1/
讨论(0)