mat420
09-20-2015, 03:39 PM
Any idea? Im not too good with code. Code works fine when I just put the code in jquery.js (yeah i know its javascript), right before </body>. Thank you.
<head>
<link rel='stylesheet' media='screen and (max-device-width: 640px)' href='jquery.js'>
</head>
jquery.js
function myFunction() {
var container = document.getElementById('container'),
divs = container.getElementsByTagName('div'),
tmpdiv = document.createElement('div'),
order = [3, 2, 1];
for (var i = 0; i < order.length; i++) {
tmpdiv.appendChild(document.getElementById('div' + [order[i]]));
}
container.parentNode.replaceChild(tmpdiv, container);
}
window.onload = myFunction();
<head>
<link rel='stylesheet' media='screen and (max-device-width: 640px)' href='jquery.js'>
</head>
jquery.js
function myFunction() {
var container = document.getElementById('container'),
divs = container.getElementsByTagName('div'),
tmpdiv = document.createElement('div'),
order = [3, 2, 1];
for (var i = 0; i < order.length; i++) {
tmpdiv.appendChild(document.getElementById('div' + [order[i]]));
}
container.parentNode.replaceChild(tmpdiv, container);
}
window.onload = myFunction();