Skip to content
Advertisement

Remove all selected HTML element with innerText using javascript

I’m trying to parse html tags and want to remove <select> from code which is given in TextArea1 and want to show output in TextArea2 on button click.

JavaScript

In my TextArea1 i have code like

JavaScript

This code return output like:

JavaScript

Please help me to remove all <select>...</select> with all of it’s <option> with innerText and want to output like this:

JavaScript

Thanks in advance.

Advertisement

Answer

Here updated version with different approach. We create new html element from the input value and and get span elements textContent.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement