Eido96 Posted February 20, 2016 Posted February 20, 2016 My suggestion is to add HTML DOM element object outerHTML attribute for the JavaScript reference. It seems that most, if not all, the browsers support this attribute. In addition, it is important and basic attribute that new JavaScript developers should know about. 1
Ingolme Posted February 20, 2016 Posted February 20, 2016 I actually don't think it's important. It has the potential to mess up the DOM. I have never had a need for it.
blueprinter Posted June 27, 2017 Posted June 27, 2017 I have had a need for it, and it is very important. I use it to copy the last row of a table to add a new row. It saves the user a lot of work. It's a lot easier than a "work around."
justsomeguy Posted June 27, 2017 Posted June 27, 2017 There's a more correct way to do that. The table element has a rows property that contains a collection of all of the rows: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement You can access the last row element and then use cloneNode to create a copy, and then appendChild to add it as a child of the tbody. https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode You can also use the DOM methods to create a new row and add cells to it: https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/insertRow
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