I have been learning Javascript and I'm a little confused as to why this doesn't work. I'd like it so if you click the div, it creates a red border around it:
HTML:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> <title>Generation X</title> </head> <body> <script src="test.js"></script> <div id="clickHere" onclick="run()"> <p>Hello</p> </div> </body> </html> Javascript:
function run() { document.getElementById("clickHere").style.border = thick solid red; alert("Changed"); }