mainifest.json:
{
"name": "Search",
"version": "1.0",
"manifest_version": 2,
"description": "Search",
"browser_action": {
"default_icon": "search.png",
"default_popup": "popup.html"
},
"content_scripts": [{
"matches": [
"<all_urls>"
],
"js": ["jquery-3.1.1.min.js", "content.js"]
}]
}
popup.html:
<html>
<head>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
</head>
<body>
<input type="text" id="domain">
<script type="text/javascript" src="content.js"></script>
</body>
</html>
content.js:
$(document).ready(function() {
$("#domain").change(function() {
console.log($("#domain").val());
});
});
The event change
input when I typed is not working correctly. For example:
When I type the word test
, in the console only show the word test
. It should be: t
, te
, tes
, test
.
Or when I used alert
instead of console.log
is not working too, but when I clicked in the popup.html
the alert displayed and disappear quickly