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

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -