Trying to set up an on click event listener for a submit button. Here is my jQuery code -
(function($) {
console.log('working');
$("#submit").on('click', function(event) {
event.preventDefault();
console.log('test');
});
})(jQuery);
Here is the HTML -
<input type="submit" id="submit" value="Submit Result" />
I'm doing this on a Word Press site. I know the .js file is linked correctly because I see the 'working' console log.
What is wrong with the code?
Edit -
Just tried this -
$(window).on('click', function() {
console.log('test');});
And that works. Is there an issue with how I have my ID set up in the HTML?