简体   繁体   中英

Javascript trigger touchEvent

How can I trigger a touchEvent(start/motion/end) from a javascript function for a DOM element with specified id?
Sample html page follows:

<!DOCTYPE html>
<head>
  <meta charset="utf-8">
  <title>JS Example</title>
</head>
<body>
  <p id="info"></p>      
  <div id="data"></div>
  <script src="app.js"></script>
</body>

Suppose here touchEvent is needed for 'data' div element.

I'm very new to javascript, so any kind of sources are highly appreciated.

you can use jquery with the syxtax

$(document).ready(function(){ 
    $('#data').click() // or whatever you want here
})

you can reference to http://jquery.com to get the function to do with your div tag

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