WebSite X5Help Center

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

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

Autor: Дмитрий Тулупов
Visited 223, Followers 1, Udostępniony 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.

Posted on the
2 ODPOWIEDZI - 1 POMOCNY - 1 PRAWIDłOWA ODPOWIEDź
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Najlepszy Użytkownik miesiąca IT

... 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

.

Czytaj więcej
Posted on the from  ‪ KolAsim ‪ ‪
Дмитрий Тулупов
Дмитрий Тулупов
User
Autor
 ‪ 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!

Czytaj więcej
Posted on the from Дмитрий Тулупов