The form will not be submitted properly in IE

My simple donation form is sent correctly, with the exception of Internet Explorer. I am sure that this is due to problems with change () and focus () or blur (), but all my hundreds of attempts so far have failed. I tried using .click () instead of change (), as mentioned in this post: Getting jQuery to recognize .change () in IE (and elsewhere), but I could not get it working! ... so I skipped that something simple, maybe.

Here is a link to the page: http://www.wsda.org/donate

HTML FORM:

<form id="donationForm" method="post" action="https://wsda.foxycart.com/cart.php" class="foxycart">
<input type="hidden" id="name" name="name" value="Donation" />
<input type="hidden" id="price" name="price" value="10" />
<div class="row">
 <label for="price_select">How much would you like to donate?</label>
 <select id="price_select" name="price_select">  
                <option value="10">$10</option>
  <option value="20">$20</option>
  <option value="50">$50</option>
  <option value="100">$100</option>
  <option value="300">$300</option>
  <option value="0">Other</option>
 </select>
</div>
<div class="row" id="custom_amount">
 <label for="price_input">Please enter an amount: $</label>
 <input type="text" id="price_input" name="price_select" value="" />
</div>
<input type="submit" id="DonateBtn" value="Submit Donation »" />
</form>

Jquery:

// donation form
$("#custom_amount").hide();
$("#price_select").change(function(){
   if ($("#price_select").val() == "0") {
      $("#custom_amount").show();
   } else {
      $("#custom_amount").hide();
   }
   $("#price").val($("#price_select").val());
});

$("#price_input").change(function(){
   $("#price").val($("#price_input").val());
});
+3
source share
1 answer

, : jQuery .change() IE - script , !!

script, WORKS!:

// donation form
$("#custom_amount").hide();
$("#price_select").change(function(){
   if ($("#price_select").val() == "0") {
      $("#custom_amount").show();
   } else {
      $("#custom_amount").hide();
   }
   $("#price").val($("#price_select").val());
});

if ($.browser.msie) {
  $("#price_input").click(function() {
    this.blur();
    this.focus();
  });
};

$("#price_input").change(function(){
   $("#price").val($("#price_input").val());
});
0

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


All Articles