Horje
move list items up and down using javascript Code Example
move list items up and down using javascript
window.onload = function () {
	var upLink = document.querySelectorAll(".up");

	for (var i = 0; i < upLink.length; i++) {
		upLink[i].addEventListener('click', function () {
			var wrapper = this.parentElement;

			if (wrapper.previousElementSibling)
			    wrapper.parentNode.insertBefore(wrapper, wrapper.previousElementSibling);
		});
	}

	var downLink = document.querySelectorAll(".down");

	for (var i = 0; i < downLink.length; i++) {
		downLink[i].addEventListener('click', function () {
			var wrapper = this.parentElement;

			if (wrapper.nextElementSibling)
			    wrapper.parentNode.insertBefore(wrapper.nextElementSibling, wrapper);
		});
	}
}




Javascript

Related
javascript array of all characters Code Example javascript array of all characters Code Example
fullscreen electron Code Example fullscreen electron Code Example
how to vibrate phone using javascript Code Example how to vibrate phone using javascript Code Example
transformorigin gsap Code Example transformorigin gsap Code Example
how to add comment in react js Code Example how to add comment in react js Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7