简体   繁体   中英

javascript onblur and onfocus events in iPad Safari

I'm writing an order entry web application. I don't think it matters here, but the server side is in .Net MVC.

In the order page, each line is a separate html form with a unique identifier. When a user changes the order quantity, the line is submitted and refreshed with an AJAX call.

Here's the basic setup:

function submitLine(id) {
   var selector = "form#Frm" + id;
   $(selector).trigger("onsubmit");
}


<td class="order-qty">
  <input id="Item_CaseQty" name="Item.CaseQty" onblur="submitLine('ffdc1d61-9025-416b-b62e-09691cf64bb8');" type="text" value="5" />
</td>

This works fine in (at least) IE8, Chrome, and Android.

It does not work on iPad Safari. I have some other, less critical, defects on the iPad that seem to be related to focus/blur issues. Are these events not supported on iPad? If not, are there others that I could use instead.

I was completely wrong about the cause of this error and about the relevance of .Net MVC. I using MVC 2.0 and the Ajax.BeginForm() helper to implement the Ajax update. I found out that it's Ajax.BeginForm that doesn't work correctly in Safari. This appears to be true of all Safari implementations, not just the iPad. I fixed the problem by removing the MVC helper, and using jQuery.Ajax() instead, along the lines described here: Using Ajax.BeginForm with ASP.NET MVC 3 Razor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM