Form return false wont work in internet explorer

This works in FF and Chrome, but I can't stop submitting the form in IE8.

JQuery is included in the document ready function

$("#reserveAPickupAppointmentRoommate").click (function() { roommate = $("#roommate").val(); $.post('roommateSearch.php', 'val=' + roommate, function (response) { $("#roommateResults").html(response); }); return false; }); 

Corresponding submit button in my form:

 <input type="image" src="images/arrow.png" class="reserveAPickupAppointmentRoommate" id="reserveAPickupAppointmentRoommate"> 
+4
source share
1 answer

Try processing the submit form, not the submit button click :

 $("#yourFormId").submit (function() { roommate = $("#roommate").val(); $.post('roommateSearch.php', 'val=' + roommate, function (response) { $("#roommateResults").html(response); }); return false; }); 
+3
source

Source: https://habr.com/ru/post/1387830/


All Articles