I am still very new with chrome extensions and am just testing things out.
Right now I have a popup.html that with a short form that I want to create an alert when submit is clicked. I cannot for the life of me figure out why it’s not working.
<!doctype html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="popup.js">
</script>
</head>
<body onload="alert('open')">
<form>
Username: <input type='text' id="username" name='username'></input>
Password: <input type='password' id='password' />
<button onclick="alert('test');return false;">Login</button>
</form>
</body>
</html>
Any suggestions?
Edit: I even made an onload in the body tag to see if an alert would open there but it doesn’t. In the popup.js I have an alert open on window.onload and that works however.
The function stops after you return false.
Put return false at the end of the statement, then your alert should work. Or you could take it out.
Update
After some research I found out the following…
Source here