good day. how can i modify the text of textarea input using javascript
i have this content in my textarea, i want to remove the PublisherImprintName tag using jquery
<PublisherInfo>
<PublisherName>Ask question</PublisherName>
<PublisherLocation>ph</PublisherLocation>
<PublisherImprintName>ask stackoverflow</PublisherImprintName>
<PublisherURL>stackoverflow.com</PublisherURL>
</PublisherInfo>
and the posible output is
<PublisherInfo>
<PublisherName>Ask question</PublisherName>
<PublisherLocation>ph</PublisherLocation>
<PublisherURL>stackoverflow.com</PublisherURL>
</PublisherInfo>
is it possible using jquery?
i searched and i found this code, but i can't apply this to my problem, but the solution is almost similar
<script>
$(document).ready(function(){
$("button").click(function(){
$("PublisherImprintName").remove();
});
});
</script>
thank you. sorry for asking too many questions
another question:
how can i remove tag name but retain its value?
i found a solution about that here: i tried applying it on my problem, but i can't make it work
Remove a HTML tag but keep the innerHtml
here is the text on my text area
<PublisherInfo>
<PublisherName>Ask question</PublisherName>
<PublisherLocation>ph</PublisherLocation>
<PublisherImprintName>ask stackoverflow</PublisherImprintName>
<PublisherURL>stackoverflow.com</PublisherURL>
</PublisherInfo>
and the possible output
<PublisherName>Ask question</PublisherName>
<PublisherLocation>ph</PublisherLocation>
<PublisherImprintName>ask stackoverflow</PublisherImprintName>
<PublisherURL>stackoverflow.com</PublisherURL>