长按复制功能 -- 移动端安卓跟ios

 

html:

<p class="codeAnd">3024</p>
<input class="codeIos" type="text" value="3024" readonly />

 

script:

<script>
var codeAnd=$(".codeAnd");
var codeIos=$(".codeIos");
if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
codeIos.show();
codeAnd.hide();
}else{
codeAnd.show();
codeIos.hide();
}
</script>

posted @ 2016-05-04 16:25  xiangcy  阅读(586)  评论(0编辑  收藏  举报