javascript - How can I rearrange the order of HTML tags? -


let's have

<div id="div1"></div> <div id="div2"></div> <div id="div3"></div> 

how can change order to

<div id="div2"></div> <div id="div1"></div> <div id="div3"></div> 

using javascript / jquery or ajax?

thank much!

in specific instance, use insertbefore:

$('#div2').insertbefore('#div1'); 

if want more complex, you'll have explain logic.

jsfiddle


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -