user357034
user357034

Reputation: 10981

move element after certain element + two `<br>`

I have the following code which works fine, however I wanted to know if there is a better way to add the <br>'s

Is there a better more efficient way to do it.

<script type="text/javascript" language="javascript">
$(function(){
$('#pt656').after($("input[name='btnaddtocart']"));
$('#pt656').after('<br><br>');
});
</script>

Upvotes: 1

Views: 699

Answers (1)

Damiqib
Damiqib

Reputation: 1077

You can add space between elements with CSS. Following adds 20px space between elements #pt656 and btnaddtocart.

<script type="text/javascript" language="javascript"> 
  $('#pt656').after($("input[name='btnaddtocart']").css('margin-top', '20px'));
</script> 

Upvotes: 2

Related Questions