I have a problem, I am recovering content from a web page using
product.querySelector('div#productspecification').innerHTML
from NodeJS
If this works, it returns the content that is inside that div, with that id. the problem is that it returns two <div>
with javascript tags that I can't store in the database. These are the <div>
ones with javascript tags:
<div class="col-md-1" data-hideonprint="true">
<script type="text/javascript" src="/Site/Scripts/CNet.js"></script>
<script type="text/javascript">
window.onload = function () {
handleCnetLogos('https://ws.cnetcontent.com','https: //ws.cnetcontent.com','c7b4bb94','KONICA%20MINOLTA','8938613','MX01@@6030@@10@@','es_MX','1','1x4',false);
}
</script>
<div id="ccslogos">
</div>
</div>
how can i remove the javascript tags and content like the window.onload
To remove both the
script
and its content, use a regular expression: