Put this after or below input element. The input element wasn't loaded yet and the javascript is executed so you get null.
Solution 1:
Solution 2:
Or if you preffer putting scripts in the head of html, run the function only when the page is loaded.
On your separate javascript page:
function show()
{
var supporter = document.getElementById('supporter');
if (supporter.value == "yes")
{
alert("it works");
}
}
//When page loaded
document.onload = function(){
show();
};
Note: you don't have to put
in your JavaScript file.