Safari cannot trigger click event Processing under iOS

Source: Internet
Author: User

Safari under iOS is so proud, it's a lot of pits.

First on the code

<!DOCTYPE HTML><HTML><Head>    <title>122</title>    <Metaname= "Viewport"content= "Width=device-width, initial-scale=1.0, minimum-scale=1.0, Maximum-scale=1.0,user-scalable=no"></Head><Body><Div>ADFAFASDFASDFASDFASFDASDF<BR/>ADFAFASDFASDFASDFASFDASDF<BR/>Adfafasdfasdfasdfasfdasdf<BR/>ADFAFASDFASDFASDFASFDASDF<BR/>ADFAFASDFASDFASDFASFDASDF<BR/>Adfafasdfasdfasdfasfdasdf<BR/>Adfafasdfasdfasdfasfdasdf<BR/>ADFAFASDFASDFASDFASFDASDF<BR/>Adfafasdfasdfasdfasfdasdf<BR/>Adfafasdfasdfasdfasfdasdf<BR/></Div><Div>    <imgsrc= "__img__/indexbanner.png"alt=""/></Div><Scriptsrc= "__js__/jquery-1.11.1.min.js"></Script><Script>    $(function(){        $('Body'). On ("Click", function(e) {alert ("Click");    }); })</Script></Body></HTML>

Question: Do you click on the text and click on the image will pop up "click"?

Hehe hehe, the result is only the second IMG Click can trigger the click correctly, click the text in the div completely no effect.

The workaround is to bind to the "Touchend" event ...

This bug can only be seen in iOS Safari, desktop, Android, Apple is really proud of it.

PS: Mobile-click Processing or try to use touch-class events. Click the pit too much.

Safari cannot trigger click event Processing under iOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.