You can prevent the default action of an event using jQuery’s preventDefault() method. For example, to prevent a form from being submitted when the submit button is clicked, you would use the following code:
$('#myForm').on('submit', function(event) {
event.preventDefault();
// code to handle the form submission
});