Im trying to set up a function where once a html button is pressed, a function checks a variable and redirects a link to a new window if the value comes back positive.
This is the function I’m trying to get going:
function launchTask()
{
window.open("https://www.google.com","_blank");
}
and the button
button type=“button” onclick=“LaunchTask()”
Theres probably a basic solution i’m not seeing, can somebody help?
You’ll see the error if you open the console of your dev tools – you misspelled the function name, it starts lowercased. Better though would be to avoid inline-JS altogether; your code gets much easier to debug if you have your logic separate from the markup: