Copy To Clipboard In Javascript | Click To Copy Button

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024

ความคิดเห็น • 27

  • @webcifar
    @webcifar  4 ปีที่แล้ว +7

    Source Code : codepen.io/Web_Cifar/pen/ExPdKRG
    Thanks for watching ❤✌👍

  • @mohdzafarofficial
    @mohdzafarofficial ปีที่แล้ว

    bye bye khuda hafiz
    excellent job

  • @SanchezGaming515Official
    @SanchezGaming515Official 2 ปีที่แล้ว

    Now I learned phising

  • @ratemyportfolio
    @ratemyportfolio 2 ปีที่แล้ว

    Very helpful - many thanks.

  • @NathanNordby
    @NathanNordby 4 ปีที่แล้ว +2

    Love these challenges. Thank you so much for putting them together!

    • @webcifar
      @webcifar  4 ปีที่แล้ว

      Glad you like them!

  • @anumulasravani9236
    @anumulasravani9236 3 ปีที่แล้ว +1

    It's really good Sir. Nice explanation.

  • @islamicseries8991
    @islamicseries8991 3 ปีที่แล้ว

    Wow Really Amazing Video, it’s very helpful for the beginners of javascript.
    Thank You Very Much.
    Take Love from Bangladesh🥰

  • @JohnnyWhite_DE
    @JohnnyWhite_DE ปีที่แล้ว

    Hello. What's the software you use to edit the sites?

  • @mohammadabbasi9181
    @mohammadabbasi9181 4 ปีที่แล้ว +1

    It's amazing ... ❤😎

    • @webcifar
      @webcifar  4 ปีที่แล้ว

      Thank you.

  • @eelguneezmemmedov1671
    @eelguneezmemmedov1671 3 ปีที่แล้ว +1

    Nice work thank u so much!

  • @samarjamil3053
    @samarjamil3053 4 ปีที่แล้ว +1

    That's so cool!

    • @webcifar
      @webcifar  4 ปีที่แล้ว

      Thanks Brother ❤

  • @romuloalves9349
    @romuloalves9349 4 ปีที่แล้ว +1

    Ótimo vídeo parabéns 👏.

    • @webcifar
      @webcifar  4 ปีที่แล้ว

      Muito obrigado 🙏✌

  • @raniaayad4285
    @raniaayad4285 3 ปีที่แล้ว

    Thank you it's great but how can l use it more than once within the same page?? Sorry I'm a js beginner

    • @raniaayad4285
      @raniaayad4285 3 ปีที่แล้ว

      @@NorthTonawanda1oh that would be great thank you +good luck with it 😄

  • @adamszabo91
    @adamszabo91 2 ปีที่แล้ว +1

    Dear @Web cifar,
    Thank you for this video. This was really usefuld :)
    It works for me when I modify according to my needs, though when I try to create a second box.
    I've duplicated the classes, divs/h2-s (e.g., content 2 etc.) and every field.
    Everything works even popups but when it comes to copytoclipboard function --> select part, it's throwing the following error:
    Uncaught TypeError: textarea2.select is not a function
    This is the script I used:
    const text2 = document.querySelector(".content2 h2");
    const popup2 = document.querySelector(".popup2");
    text2.addEventListener("click", () => {
    popup2.classList.add("active");
    copyToClipBoard2();
    });
    popup2.addEventListener("animationend", () => {
    popup2.classList.remove("active");
    });
    function copyToClipBoard2() {
    const textarea2 = document.createElement("textarea2");
    textarea2.setAttribute("readonly", "");
    textarea2.value = text2.innerText;
    textarea2.select();

    }
    do you have any idea why? :)
    Thaank you in advance! :)

    • @webcifar
      @webcifar  2 ปีที่แล้ว +1

      I prefer this new web api instead of this old method. Check it out. You will like it too. developer.mozilla.org/en-US/docs/Web/API/Clipboard_API

    • @webcifar
      @webcifar  2 ปีที่แล้ว +1

      Though the problem was you tried to create an element and you passed the type textarea2. This is not an valid element type. You need to create the element with textarea.
      const textarea2 = document.createElement(“textarea”);

    • @adamszabo91
      @adamszabo91 2 ปีที่แล้ว

      @@webcifar Thank you so much for your help :) it workeeeeeed!!!!!!
      Sorry, I just started this scripting a week ago, so I'm quite new :)

  •  3 ปีที่แล้ว

    Obrigada

  • @kwquinch
    @kwquinch 2 ปีที่แล้ว

    Whats the software called?

  • @a_basic_sheep_1993
    @a_basic_sheep_1993 2 ปีที่แล้ว

    tell me not lol, you are a great hacker in JavaScript lmao. can you copy the code im typing ? hahaha, thank you for the video man, inspired me to become a hacker for the underground