我在android webview中創建了一個應用程序,我希望可以複製某些東西。所以當你按下一個按鈕時,你將有東西被複制到你的剪貼板。 我試過"clipboard.js"工作瀏覽器,但不是在Android上。所以我用這個javascript:當你選擇[CSS,JS,android]時,防止標準動作
var copyXBT = function() {
var theTheCopyXBTAdr = $('#theToCopyXBT');
theTheCopyXBTAdr.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copying text command was ' + msg);
} catch (err) {
console.log('Oops, unable to copy');
}
};
但是,當你按下輸入類型文本將得到一個藍色,..和藍色邊框(android webview黃色),並在Android上你的鍵盤會彈出。
我用這個CSS樣式來「隱藏」它。因爲我不能說沒有顯示。如果我這樣做,我不會工作。
#theToCopyETH{
color: white;
border: 0px solid white;
}
::selection{
background: white;
color: white;
}
這是我的一塊HTML的:
<button class="btn btn-coinchecker" id="copyETH">Copy ETH address</button><button class="btn btn-coinchecker" data-toggle="modal" data-target="#showETHQR">Click me to get the QR-code</button>
<input type="text" id="theToCopyETH" value="*********************">
例如參見fiddle。(請在谷歌瀏覽器打開)
所以我的問題是如何防止的彈出鍵盤和android系統中擺脫黃色邊框(谷歌桌面版Chrome是藍色)
預先感謝幫助我!
visibility:hidden的;行爲與顯示無相同;和指針的事件,什麼也不做,但感謝! – Steven