Javascript/ Jquery: Get element from string -
I have to remove an HTML element from the string.
Any suggestions, please leave it below. < substr ()
Var mystring = "smth and lt; table & gt; asdasdasd & lt; / table & gt; smth else"; Var firstPart = myString.substr (0, myString.indexOf ('& lt; Table & gt;')); Var secondPart = myString.substr (myString.lastIndexOf ('& lt; / table & gt;' 8); Mystring = First Part + Second Part; > UPD And I use the jQuery method to delete the table from the DOM: $ (document) .ready (function () {$ ('# tableId'). Remove () ;})
or pure js:
Var table = document.getElementById (tableId); table.parentNode.removeChild (table); < / Code>
Comments
Post a Comment