WebSite X5Help Center

 
Дмитрий Тулупов
Дмитрий Тулупов
User

Question for kolasim!How to configure the copy button correctly?  en

Autore: Дмитрий Тулупов
Visite 1072, Followers 1, Condiviso 0  

Hello. If anyone knows the answer to my question, please let me know.

I am sure that KolAsim, respected here, who has repeatedly helped me with codes, will easily help in this matter.
In the footer of the site 5958.ru, I installed a button, by clicking on which the guest of the site can copy the bank card number.

I found on the Internet (https://jsfiddle.net/webdevhelp/bso96npm/5/) a more suitable option for me and installed the button. But unfortunately I could not install the script, since I have never done this on the constructor. I made several attempts, but I did not achieve a working effect. I installed the button itself with the text using the HTML module.

I also clarified at the hosting that their system supports JavaScript + jQuery.

Please give detailed instructions for installing the script!

If you have an alternative copy button, please post it here.

Sincerely,
Dmitriy.

Postato il
2 RISPOSTE - 1 UTILE - 1 CORRETTO
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Utente del mese ESUtente del mese PT

... in the HTML Code Object paste all this code:
<div id="text">123 456 789</div>
<button id="copy">▲ Copy the text-number </button>
<script>
$('#copy').click(function() {    var $temp = $("<input>");    $("body").append($temp);    $temp.val($('#text').text()).select();    document.execCommand("copy");    $temp.remove();    $(this).text('copied text!'); });   
</script>

.

ciao

.

Leggi di più
Postato il da  ‪ KolAsim ‪ ‪
Дмитрий Тулупов
Дмитрий Тулупов
User
Autore
 ‪ KolAsim ‪ ‪
... in the HTML Code Object paste all this code: <div id="text">123 456 789</div> <button id="copy">▲ Copy the text-number </button> <script> $('#copy').click(function() {    var $temp = $("<input>");    $("body").append($temp);    $temp.val($('#text').text()).select();    document.execCommand("copy");    $temp.remove();    $(this).text('copied text!'); });    </script> . ciao .

May God grant you good health, long life and success in your affairs!

Leggi di più
Postato il da Дмитрий Тулупов