0

Im trying to figure out if it is possible to move the

div tag>

so let's say i have paragraph and below it is a image something like this enter image description here

is what i want to know if it's possible, and if it is, please can anyone tell me how using jquery or javascript.

Kim Tormes
  • 81
  • 2
  • 8
  • 1
    Yes, it's indirectly possible. Can you please post the code that you tried? – Josh Crozier Nov 28 '15 at 19:13
  • please show how to do it @JoshCrozier – Kim Tormes Nov 28 '15 at 19:13
  • No, it's not possible. You can move an image out of a div, but you cannot move the end of the div itself. That's because the HTML document is translated to an in-memory object structure, which has no notion of closing tags. It does have nodes with a parent-child relation, so you could change the image from being a child of the div to being a sibling of the div. – GolezTrol Nov 28 '15 at 19:15
  • aww~, so it's not how sad. anyway, can you show me hot to move image out of the div? @GolezTrol – Kim Tormes Nov 28 '15 at 19:16

1 Answers1

0

I created a fiddle , http://jsbin.com/qunece/edit?html,js,output

You can copy the contents of one and append it to the other

var html = $('#id2').html();
$('#id1').append(html);
$('#id2').remove();
Zohaib Ijaz
  • 21,926
  • 7
  • 38
  • 60