Catching the Click on DOM/HTML/BODY event on the iPad

前端 未结 7 1048
梦毁少年i
梦毁少年i 2021-02-04 05:55

I\'m using jQuery to detect a click on the DOM - or let\'s every click.

$(document).click(function(){
   alert(\"Click :-)\");
});

This works p

7条回答
  •  星月不相逢
    2021-02-04 06:40

    ... your page tags ...

    There is a minor difference with others browsers behaviour: the document object will reveive click events only for tags located inside the "... your page tags ..." section.

    In other words, suppose your html and body tags have a yellow background color, and their child tags have a red background color. The document object will receive clicks on the red areas only. This is usually not a serious drawback.

    Tested on an iPhone 3 only

提交回复
热议问题