Copy to Clipboard using HTML, CSS & JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024
  • In this video, I will show you how you can copy text to clipboard using HTML, CSS & JavaScript. In this, once your text is copied to clipboard you will get small tooltip which will show copied message for better user experience.

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

  • @tracer2518
    @tracer2518 2 ปีที่แล้ว +11

    Didn't find what I was looking for, but is was very satisfying to watch how a plain HTML codde gains shape with CSS

  • @Mr-Singh21
    @Mr-Singh21 3 ปีที่แล้ว +3

    Thanks for the tutorial man! I'm newbie this tutorial helped me a lot.

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

    i dunno why my doesnt make image on button. please help me

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

      Add fontawesome 4.7 library link

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

      @@Codingflag thank you sir

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

    This is a very easy way to solve the problem: document.querySelector("button").onclick = function () {
    navigator.clipboard.writeText(document.querySelector("input").value);
    };

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

    In mine, the command “execComand” is saying that the method is obsolet. Is there other alternative?
    I’m using VsCode

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

      Yes. execCommand is deprecated but it will still run on browsers.
      Instead of execCommand you can use below line.
      navigator.clipboard.writeText(text);

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

      I’ll try it! Thanks for the answer. Very good video, I’m a begginer and it helped me a lot

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

    please explain the concepts

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

    Thanks was really only looking for the "document.execCommand("copy");" but exellent video.

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

    What program are you using to see a live preview and nicely separated HTML,CSS,Java sections?

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

      Its online editor, Codepen.

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

      @@Codingflag awsome thank you!

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

      but you can use a VSCode extension, called Live Server

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

      @@ymo8609 Awesome! Thank you. Codepen is cool but it's a few more extra steps. This small inconvenience tends to hinder me from using it as often as I probably should.
      I'll be trying out this new extension out shortly (since I'm currently working on a project).

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

    Thank u so much sir so much love form pakistan ♥️

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

    Waiting for other videos of yours.

  • @aminvalipoor2061
    @aminvalipoor2061 3 หลายเดือนก่อน

    How can i find this code?

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

    Thx , you helped me

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

    please share the code link

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

    How to make multiple copy button in html??

    • @Codingflag
      @Codingflag  3 ปีที่แล้ว +2

      Assign different classes and use same method shown in video

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

    Which code editor are you using

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

    Didn't work. Get "Uncaught TypeError: copyText is null" error message.

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

      Can you share your code on codepen/github so that I can help

  • @Entertainment.Tube0
    @Entertainment.Tube0 2 ปีที่แล้ว

    Awesome ❤️❤️ 💯

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

    Awesome! Thanks so much!!

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

    Thank You So Much

  • @MuhammadRizky-bs3kw
    @MuhammadRizky-bs3kw 2 ปีที่แล้ว

    what if it is used in wordpress?

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

    Doesn't work as usual

  • @nickjames8653
    @nickjames8653 7 หลายเดือนก่อน

    thank you so much my friend, it helped me.

    • @Codingflag
      @Codingflag  7 หลายเดือนก่อน

      Glad it helped

  • @AmboDalle-g3k
    @AmboDalle-g3k ปีที่แล้ว

    but how to make bulk copy button ?

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

    need help my friend. what about on a web but no element ID on that clipboard, how to copy to clipboard(pasting copied number to clipboard) but what got only

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

      Check how you can uniquely identify that element, check it’s parent has id or not. You can use its parent and then children inside it.

  • @coderplus362
    @coderplus362 11 หลายเดือนก่อน

    perfect tutorial

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

    awesome

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

    My boss give me 100000+ shipment ids in excel file to enter in a html page which has 100+ employees. I am manually copying every single entry and pasting in the allocate box then press submit button on every single user. Is there any help available for auto copy paste and press button?

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

      yes, check document.execCommand method to copy and paste content.

  • @mdnazmulhaque3079
    @mdnazmulhaque3079 8 หลายเดือนก่อน

    from codepen code and paste elementor worpdress not working!

    • @Codingflag
      @Codingflag  8 หลายเดือนก่อน

      Any error on console?

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

    6:00

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

    Всем привет. Пожалуйста помогите разобраться. как соеденить все эти отдельные коды в один html файл и чтобы работал так же корректно??

    • @Codingflag
      @Codingflag  2 ปีที่แล้ว +5

      Put code in blocks like below.
      ADD YOUR CSS CODE BLOCK HERE
      ADD YOUR HTML CODE BLOCK HERE

      ADD YOUR JAVASCRIPT CODE BLOCK HERE

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

    Thanks sir....

  • @relaxa4896
    @relaxa4896 6 หลายเดือนก่อน

    Danke!

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

    Can we add in blogger?

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

    Link not working please updae

  • @nickjames8653
    @nickjames8653 6 หลายเดือนก่อน

    link of code, please...

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

    How make it double in one HTML?? please help me

  • @channel_nixy
    @channel_nixy 3 หลายเดือนก่อน

    Source code

  • @yashsinghal9918
    @yashsinghal9918 3 ปีที่แล้ว +2

    Please give the link for the Source Code.

    • @Codingflag
      @Codingflag  3 ปีที่แล้ว +4

      codepen.io/dsr/pen/PoprWgq

    • @FrankGP.com.
      @FrankGP.com. 3 ปีที่แล้ว

      @@Codingflag Thankyou

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

      @@Codingflag please keep adding the source code in the video description

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

    very instructive vidéo, it works ! But is there a way so we can see all the value ? My value is too long and we can"t see all of it in the text field.. can you help me ? :)

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

      you can increase width of textfield

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

      @@Codingflag of course ! thanks aha =)

  • @EricaOrtiz-s8k
    @EricaOrtiz-s8k 7 หลายเดือนก่อน

    the copy functionality works perfectly, However, the copy button is not displayed as shown in the video, what I got is a solid background in blue

    • @Codingflag
      @Codingflag  7 หลายเดือนก่อน +1

      You need to add fontawesome library to get this icon.

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

    ExecCommand is depricated...

    • @samuraitatin
      @samuraitatin 2 หลายเดือนก่อน

      😮 really!
      Thank you for sharing.

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

    ExecCommeand is not working

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

      Can you share your code so that I can help.
      It's execCommand

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

      @@Codingflag yeah its execCommand but it is not working it says 'execCommand' is deprecated

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

      Use below code instead of execCommand.
      navigator.clipboard.writeText(text);

  • @wenzu-vi3sd
    @wenzu-vi3sd 2 ปีที่แล้ว

    that is really cool !!
    thank you so much

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

      Glad you like it!

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

    или если кто то может то плиз напишите

  • @codinglyenterprisesco.3866
    @codinglyenterprisesco.3866 3 ปีที่แล้ว +1

    Doesn't work as usual

    • @Codingflag
      @Codingflag  3 ปีที่แล้ว +2

      Here is source code, please try and let me know error if it’s not working
      codepen.io/dsr/pen/PoprWgq

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

      Thanksss sirrrr for source codeeee loveee form Pakistan ♥️♥️

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

      @@Codingflag Much appreciated!