M4Q append td
Closed this issue · 2 comments
Hi Olton,
Describe the bug
$("< td>td content< /td>");
is not returning an HTMLElement.
To Reproduce
https://codepen.io/KlumsD/pen/jOLrwbd
Adding js generated td to a table.
if empty, it is added.
if not empty, it isn't added.
Same for < tr>
Expected behavior
It should work as the < p > exemple here :
https://metroui.org.ua/m4q-manipulation.html
Desktop (please complete the following information):
- OS: Win
- Browser Firefox
- Metro Version v4.5.0
Thanks !
Best Regards
Thanks for opening a new issue. The author has been notified and will review it as soon as possible.
For urgent issues and priority support, visit https://xscode.com/olton/Metro-UI-CSS or Patreon
Hi Olton,
I've found this issue on StackOverflow which explain the problem of <tr>
<td>
etc.
Searching the subject, I found a neat workaround solution with great browser compatibility:
insertAdjacentHTML
Cool Stacks about the same subject :
- https://stackoverflow.com/questions/6304453/javascript-append-html-to-container-element-without-innerhtml
- https://stackoverflow.com/questions/7327056/appending-html-string-to-the-dom
- https://stackoverflow.com/questions/1387433/fastest-way-to-append-html-content-to-a-div-using-javascript
Mozilla Doc:
Ex :
document.getElementById('tableBody').insertAdjacentHTML('beforeend', trElement);
Best Regards