This may be your problem: inline scripts do not work with "manifest_version": 2
So, I tested, and with the next manifest, your code works !
{ "name": "test", "version": "1.0", "description": "test", "manifest_version":1, "browser_action": { "default_icon": "images/padlock.png", "default_popup":"html/popup.html" }, "permissions": [ "tabs", "http://*/*" ] }
In any case .. it would be better to handle actions in popup.js, but first change the button attributes in popup.html to the following: <button type="button">Login</button>
popup.js:
$(document).ready(function(){ $(":button").click(function(){ alert("test");
Remember to insert jquery.js in the <head>
, in popup.html, just above popup.js:
<head> <title>Test</title> <script type="text/javascript" src="../js/jquery.js"></script> <script type="text/javascript" src="../js/popup.js"></script> </head>
I wish it was helpful. Regards, Jim ..
source share