84669 人が学習中
152542 人が学習中
20005 人が学習中
5487 人が学習中
7821 人が学習中
359900 人が学習中
3350 人が学習中
180660 人が学習中
48569 人が学習中
18603 人が学習中
40936 人が学習中
1549 人が学習中
1183 人が学習中
32909 人が学習中
Web ページ内のテキストをデフォルトで選択するにはどうすればよいですか?右クリックで直接コピーできるタイプ。
マスターにアドバイスを求めてください。 。 。 。 。 。 。 。 。 。 。
このコードを試してください
<div class="nhtMsgText">
<input type="text" value="MSC10" readonly class = "msg_cord">
<input type="button" value="コピー">
</div>
$ (".nhtMsgText input[type='button']").click(
function () {
$('input.msg_cord').focus(); //オブジェクトを選択
$('input.msg_cord').select(); //オブジェクトを選択
document.execCommand("Copy"); //ブラウザのコピーコマンドを実行
})
この機能をあなたのウェブサイトに実装しますか?ボタンクリックイベントを直接追加し、document.execCommand
このコードを試してください
<div class="nhtMsgText">
<input type="text" value="MSC10" readonly class = "msg_cord">
<input type="button" value="コピー">
</div>
$ (".nhtMsgText input[type='button']").click(
function () {
$('input.msg_cord').focus(); //オブジェクトを選択
$('input.msg_cord').select(); //オブジェクトを選択
document.execCommand("Copy"); //ブラウザのコピーコマンドを実行
})
この機能をあなたのウェブサイトに実装しますか?ボタンクリックイベントを直接追加し、document.execCommand
を使用します。