开发者

Chrome Extension Active Tab Selecting Problem

A short time, looking at the issue of Chrome Extension Development.

I开发者_开发问答 use jQuery and plugins. But not selecting DOM elements with jQuery.

example code here; (background.html)

<html>
<head>
<script>
function alertValue() {
    var a = $("#divName").val();
        alert(a);
}
chrome.browserAction.onClicked.addListener(alertValue); 
</script>
</head>
</html>

As a result, returns undefined.


If I understood correctly you want to read a value of some element on a current page when a user clicks a browser action icon.

To do this you need to use a content script to actualy read the value on a page, and message passing to communicate between a background page and a content script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜