How to execute javascript code from button in popup.html

3,649 views
Skip to first unread message

Kwstas Na

unread,
Mar 7, 2015, 10:55:39 AM3/7/15
to chromium-...@chromium.org
Hello.

I have already made the popup.html design
and it loads perfect.

I have added one button on the popup.html and i would like you to give me any example of what should i do
so this button when is pushed to execute one javascript code.

I have already tried " <script></script> tags and write inside my code but its not working.

Any other ideas?

Kwstas Na

unread,
Mar 7, 2015, 10:58:45 AM3/7/15
to chromium-...@chromium.org

Dennis Nailz

unread,
Jun 10, 2015, 4:40:12 AM6/10/15
to chromium-...@chromium.org
I have added one button on the popup.html and i would like you to give me any example of what should i do
so this button when is pushed to execute one javascript code.

in popup.html link to the javascript file 

<script src='popup.js'></script>

in this .js you put the code

document.getElementById('thebutton').onclick = doSomeStuff;
function doSomeStuff() { etc }



Reply all
Reply to author
Forward
0 new messages