//DOM does not provide insertAfter() method
function insertAfter( newElement, targetElement){
var parent = targetElement.parentNode;
if (parent.lastChild == targetElement) {
// If the last node is the target element, add it directly. Because the default is the last
parent.appendChild(newElement);
}
else {
parent.insertBefore(newElement, targetElement.nextSibling);
//If not, insert in the target element in front of the next sibling node. That is, behind the target element
}
}
jQuery document operation - insertAfter() method Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn