JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › General Discussions › editor getHTML() return too many css
- This topic has 2 replies, 2 voices, and was last updated 1 year, 9 months ago by
Dark Beccio.
-
AuthorPosts
-
November 18, 2022 at 4:40 pm #104003
Dark Beccio
Participanthi,
is it possible to retrive the html content of the scheduler without the style properties?
<table aria-rowcount=”8″ aria-colcount=”2″ resizable=”undefined” style=”box-sizing: border-box; border-collapse: collapse; width: 245px; empty-cells: show; border-spacing: 0px; table-layout: fixed; color: rgb(90, 90, 90); font-family: Roboto, "Helvetica Neue", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; background-color: rgb(254, 254, 254);”><tbody style=”box-sizing: border-box;”><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: 102.479px; min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”></td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>Valori Medi per 100g</td></tr><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>Energia</td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>1120kj</td></tr><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”></td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>268kcal</td></tr><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>Grassi</td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>0,5g</td></tr><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>Carboidrati</td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>59,5g</td></tr><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>di cui Zuccheri</td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>7,2g</td></tr><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>Proteine</td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>8,1g</td></tr><tr style=”box-sizing: border-box;”><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>Sale</td><td style=”box-sizing: border-box; border: var(–smart-border-width) solid var(–smart-border); width: var(–smart-editor-table-column-width); min-height: var(–smart-editor-table-cell-min-height); min-width: var(–smart-editor-table-cell-min-width); padding: 2px 5px; vertical-align: middle;”>0,73g</td></tr></tbody></table>
this is what i get from getHTML() but i only need the html tag without width,padding,style ecc.
TY
November 22, 2022 at 2:35 pm #104009svetoslav_borislavov
ParticipantHi,
You can select every child element, remove the style property, and then get the inner HTML.
const table = document.querySelector(‘table’);
table.removeAttribute(‘style’);const tableElements = table.querySelectorAll(‘*’);
tableElements.forEach(el => el.removeAttribute(‘style’))console.log(table.innerHTML);
I hope this helps, if not, do not hesitate to contact us!
Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/-
This reply was modified 1 year, 9 months ago by
svetoslav_borislavov.
December 1, 2022 at 10:45 am #104043Dark Beccio
Participantsolved ty
-
This reply was modified 1 year, 9 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.