jQuery(document).ready(function($) {
"use strict";
$("#").on('submit', function(e) {
e.preventDefault();
return false;
});
$(window).on("keydown", function(event) {
/* Enter & Space are required for Safari, the Chromium based MS Edge, and Chrome. Firefox works with key codes */
if ( event.which == 'Enter' || event.which == 'Space' || event.which == 13 || event.which == 32 ) {
event.preventDefault();
return false;
}
});
});
Forgive my ignorance, but where do I input the code? I'm using WordPress.
jQuery goes anywhere your system allows you to use use custom jQuery code on a page. The where in this case is specific to your site/theme. You can also add jQuery to the after fields area on the form's customize HTML page or in the after content area of a view.
Wrap any code snippet above with and drop it in the after fields area as noted as a quick check. Then you might decide to put it somewhere that makes more sense.
Okay so when I try to add the code to the After field in the Customize HTML field in settings ... It just shows the code on the page. What am I doing wrong?
Did you wrap it with script tags?
Please login or Register to submit your answer
According to an article on stack overflow:
$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
Forgive my ignorance, but where do I input the code? I'm using WordPress.