For the native JS insertBefore(...) method, you can read it on MDN Reference
So we're going to create a helper function like jQuery after(...) or insertAfter(...).
For reference, these are the jQuery documentations:
after(...)
method documentationinsertAfter(...)
method documentation
Because jQuery already claimed insertAfter
, we'll use other term for the function name. Let's call it putAfter
.
In this, we actually will implement the native JS insertBefore
method.
It goes like this:
How to Use
That's all. Thanks for visiting.
Additional References
nodeType
property and Node.ELEMENT_NODE
: node type reference on MDN
No comments:
Post a Comment
Tell me what you think...