Skip to content Skip to sidebar Skip to footer

Physical Mouse Click Vs Simulated Button Click?

Hello Stackoverflow! I am experimenting with getting a chrome extensions cript to click a page button to trigger an AJAX request, however it would seem that physically clicking sai

Solution 1:

The page reloads because the type of the button is "submit". You could attach an event handler to the "click" button that can submit the form without reloading the page. Your code will look something like this:

Using JQuery:

$('#submitButton').on('click', function(e){
   e.preventDefault(); // stops default submit
   $('#2913').submit(); // or the ID of your form
});

And your HTML will be :

<inputtype="button" value="Continue ..."id="submitButton">

Post a Comment for "Physical Mouse Click Vs Simulated Button Click?"