//html
<input id="inviteLink1" type="text" value="http:www.66ddcc.cn/user/invite?uid=15467789331"/>
<button class="inviteBtn1" data-clipboard-action="copy" data-clipboard-target="-sharpinviteLink1"></button>
//js
$(".inviteBtn1").on("tap", function() {
try {
if(window.clipboardData.setData("Text", $("-sharpinviteLink1").val())){
alert("1");
}else{
alert(""" 1");
}
} catch(e1) {
try {
var clipboard = new Clipboard("-sharpinviteBtn1");
clipboard.on("success", function(e) {
e.clearSelection();
alert("!2")
});
clipboard.on("error", function(e) {
alert(""" 2");
});
} catch(e2) {
inviteLink1.select();
document.execCommand("copy");
}
}
});
as far as I know, there are these three methods. The other methods are not clear. The first method seems to be not compatible. The second plug-in always tells me that Clipboard is not define, is always undefined. I don"t know. The third method doesn"t have much problem trying several browsers under Android, but it doesn"t work under ios.
is there a copy-and-paste feature that is compatible with Android and ios, or what should I do with the second method?
if you do not copy directly to the pasteboard, how to open the copy menu that comes with the browser, automatically check it and let the user click copy.