joecool2005 Posted June 5, 2018 Share Posted June 5, 2018 Hi, I have an html like this <input type="submit" value="Submit" class="zoom_button" /> <span class="zoom_results_per_page"> <label for="zoom_per_page">Results per page:</label> <select name="zoom_per_page" id="zoom_per_page"> <option selected="selected">10</option> <option>20</option> <option>50</option> <option>100</option> </select><br /><br /> </span> I would like to insert the div tag like this <div class="zoom_searchform"> <input type="submit" value="Submit" class="zoom_button" /> <span class="zoom_results_per_page"> <label for="zoom_per_page">Results per page:</label> <select name="zoom_per_page" id="zoom_per_page"> <option selected="selected">10</option> <option>20</option> <option>50</option> <option>100</option> </select><br /><br /> </span> </div> How can I do that in javascript? Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted June 5, 2018 Share Posted June 5, 2018 You can create the new div, get the input and span elements and append them to the new div, then append the div to whatever those are inside. https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now