Webページから特定のタグ内のテキストを読み取るクロム拡張機能を作成しようとしています...
しかし、値を読み取ることができません
.htmlタグを除くタグ定義内のテキストを選択する必要があります..
ここでは、タグ「定義」
アウトプット: 何かを手に入れたいという圧倒的な衝動であり、多くの場合、お金に関連している
Web ページがこのようなものであるとします。
<div id="definition">
<div class="section blurb">
<p class="short"><i>Greed</i> is an overwhelming urge to have <i>more</i>
of something
<p class="long"><i>Greed</i> is often connected with money</p>
</div>
</div>
これは私がpopup.htmlを試していたものです
<script>
var newwin = chrome.extension.getBackgroundPage();
newwin.get();
</script>
background.html
<Script>
function get()
{
var myDivObj = document.getElementById("definition");
if ( myDivObj ) {
alert (myDivObj.innerHTML);
}else{
alert ( "Alien Found" );
}
}
</Script>