Şöyle bir kod varmı vardırda bulamadım . Örnek olarak.
Telefon Numarası : 0555 555 5555 - burda kopyala butonu olcak ve telefon numarasını kopyalıcak
Html bilgisi olan biri bakabilirmi :(
9
●234
- 02-11-2022, 18:51:19Bu nedir beynim yandı kod bilgim okadar yok hocamv4r1able adlı üyeden alıntı: mesajı görüntüle
- 02-11-2022, 18:51:52Kaynak: Link;
<!-- The text field --> <input type="text" value="0555 555 55 55" id="myInput"> <!-- The button used to copy the text --> <button onclick="myFunction()">Kopyala</button>
.tooltip { position: relative; display: inline-block; } .tooltip .tooltiptext { visibility: hidden; width: 140px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; z-index: 1; bottom: 150%; left: 50%; margin-left: -75px; opacity: 0; transition: opacity 0.3s; } .tooltip .tooltiptext::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border-width: 5px; border-style: solid; border-color: #555 transparent transparent transparent; } .tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }function myFunction() { // Get the text field var copyText = document.getElementById("myInput"); // Select the text field copyText.select(); copyText.setSelectionRange(0, 99999); // For mobile devices // Copy the text inside the text field navigator.clipboard.writeText(copyText.value); // Alert the copied text alert("Copied the text: " + copyText.value); } - 02-11-2022, 18:54:23Html içine ekleyin;
<span id="phone" onClick="copy()">0 555 555 55 55</span>
sayfanın altına </body> tag öncesi de bunu ekleyin
<script> function copy(){ navigator.clipboard.writeText(document.getElementById("phone").innerText);} </script> - 02-11-2022, 18:54:45gurkanpx adlı üyeden alıntı: mesajı görüntüle
<button onclick="copy('05555555555')">0555 555 55 55</button> <script type="text/javascript"> function copy(text) { var input = document.createElement('textarea'); input.innerHTML = text; document.body.appendChild(input); input.select(); var result = document.execCommand('copy'); document.body.removeChild(input); return result; } </script>copy('') tırnak işaretleri içerisine kopyalanacak veriyi ekle - 03-11-2022, 21:04:10Butona Renk verebiliyormuyuz
v4r1able adlı üyeden alıntı: mesajı görüntüle