“Salin nilai tombol ke fungsi clipboard javascript” Kode Jawaban

Salin nilai tombol ke fungsi clipboard javascript

//U need to have a button with the id the same as its name because it is going to be sent to the clipborad.
/*Like this: */
<button onClick="SelfCopy(this.id)"  id="1">1</button>
<button onClick="SelfCopy(this.id)"  id="2">2</button>
<button onClick="SelfCopy(this.id)"  id="3">3</button>

function SelfCopy(copyText)
  {
      navigator.clipboard.writeText(copyText);
      alert("You just copied this: (" + copyText + ").");
  }
Different Dog

Salin JavaScript ke clipboard

$(document).ready(function(){
	$("#ewefmwefmp").click(function(){
    //alert()
      var copyText = document.getElementById("myInput");
      copyText.select();
      copyText.setSelectionRange(0, 99999)
      document.execCommand("copy");
      alert("Copied the text: " + copyText.value);
    
    });
});
A D Bhowmick

JavaScript Copy Clipboard

<a href="' + artworkUrl + '" onclick="copyURI(event)">Copy cover URL</a>
Gifted Gharial

Jawaban yang mirip dengan “Salin nilai tombol ke fungsi clipboard javascript”

Pertanyaan yang mirip dengan “Salin nilai tombol ke fungsi clipboard javascript”

Lebih banyak jawaban terkait untuk “Salin nilai tombol ke fungsi clipboard javascript” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya