In a C# winform application, I try to check if the innerText
of an HtmlElement
is white space or not.
String.IsNullOrWhiteSpace(elem.InnerText)
The elem.OuterHtml
is:
<div class="ad-container toplb">
<span class="leader-board">
<div id="div-gpt-ad-1409955032897-3">
<script type="text/javascript">
PbhAdUnit.cmd_push(function() {pbh_ad_units['div-gpt-ad-1409955032897-3'].display(); });
</script>
</div>
</span>
</div
The content of innerText
PbhAdUnit.cmd_push(function() {pbh_ad_units['div-gpt-ad-1409955032897-3'].display(); });
I expect innerText
to ignore scripts and return empty if there is no readable text (the text which appears on the page) inside the element. Anyway how can I ignore such elements?