I am working on chrome extension where user will enter the value in the form (extension form) and clicking on the submit button the value should fill to the current browser tab form's textbox. but i am not able to pass the value
here is the all details : manifest.json
{
"name": "My First Extension",
"version": "1.0",
"manifest_version": 2,
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"content_security_policy": "script-src 'self' https://ajax.googleapis.com; object-src 'self'",
"permissions": [
"tabs", "http://*/*"
],
"content_scripts": [
{
"matches": ["*******weburl*********"],
"js": ["jquery.js","content.js"],
"run_at": "document_start"
}
],
"web_accessible_resources": ["inject.js"]
}
popup.html
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body style="width: 400px">
<div>
<div>Search Bookmarks: <input id="search"></div>
<input type="button" name="submit" value="submit" id="submit">
</div>
</body>
</html>
content.js
(function (chrome) {
var js = document.createElement('script');
js.type = 'text/javascript';
js.src = chrome.extension.getURL('inject.js');
// document.getElementsByTagName('head')[0].appendChild(js);
(document.head || document.documentElement).appendChild(js);
}(chrome));
and here is my inject.js file
$(document).ready(function(){
// alert('Here');
$("#submit").click(function(){
document.getElementById('email').value = 'REWRWRE';
});
})
The id email is my web url form's email address but it is not filling the value after click. if i just passed the value on load it is filling that field but not after the click.
Thanks in advance!!