<!DOCTYPE html>
<html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <style> button,input{ width: 100px; height: 100px; margin-top: 100px; } </style> </head> <body> <input type="button" value="input按钮"> <button>button按钮</button> <script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script> <script> $(function(){ $("input").on("touchstart", function(){ $(this).val("input focus"); }).on("touchend", function(){ $(this).val("input blur"); }); $("button").on("touchstart", function(){ $(this).text("button focus"); }).on("touchend", function(){ $(this).text("button blur"); }); }); </script> </body> </html>
转载于:https://www.cnblogs.com/wssdx/p/8086601.html