<button type="button" class="button"></button> $('button').on('touchstart', function (e) { // $('button').on('click', function (e) { 可在电脑上设为点击事件选中查看效果 var word =window.getSelection().toString(); //长按选中的文字 if(word.length > 0){ $("#iframe").attr("src","http://cjzd.aicangjie.com/winner_dayuwen/cidian/xdhycd.php?zi=" + word +"&token="+token); $(".notebook").show(); }else if(word == ''){ $(".triumphMs").html("请先长按选中文字"); $(".triumphs").show().delay(1500).fadeOut(); }else if(word.length <= 1){ $("#iframe").attr("src","http://cjzd.aicangjie.com/winner_dayuwen/zyzd.php?zi=" + word +"&token="+token); $(".notebook").show(); } });