javascript - How to I create a Document Object based on user HTML input? -


i have textarea meant take in user html input, , purpose take out inline styling , style tags html.

i thought changing whole thing string , doing needed to, realized use dom.

is there anyway can create dom object html in textarea put in user?

this way can traverse inputted dom , remove inline styles & style tags, add classes/ids elements, , apply styles in generated css.

could on first part of creating dom html in text area? possible?

make jquery object html.

var stringhtml = $('.html-textarea').val(); //string of textarea contents  $html = $(stringhtml); 

then can whatever jquery operations (traversal, etc.) need to.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -