Dominator.js | after Property

A modern approach to DOM manipulation using the Dominator after property

Using the 'after' Property in Dominator.js

The 'after' property in Dominator.js specifies where the created element will be inserted in the DOM, relative to a target element. The created element will be placed immediately after the specified target element.

after as a String Query:


                    D$({ 
                        element: 'div', 
                        text: 'Hello, world!', 
                        after: '.example-output' 
                    });
                

after as an HTML Element:


                    const targetElement = document.querySelector('.example-output');
                    D$({ 
                        element: 'div', 
                        text: 'Hello, world!', 
                        after: targetElement 
                    });