I’m having some trouble with my Jquery code.
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {
$(".upvote").on("click", function()
{
alert('test');
}
});
</script>
</head>
<body style="background-color:black; color:white;">
<form action="#" method="post">
<input type="submit" class="upvote" value=" + " />
</form>
</body>
</html>
When I click the button, nothing happens. I checked and made sure I have jQuery 1.7. Can anyone help?
You are missing a closing
);on your handler. It’s causing a syntax error which results in the code not running