JavaScript Clipboard API Programming Tutorial

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

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

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

    One of the things that usually would've required me to google it.
    Although pretty quick, I really much appreciated this video! :)

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

      Glad to hear that Pascal. Thanks for the comment.

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

    hey man, how are you? its good to see you again. you know what? I used your tutorial to create my thesis using flash adobe and I got the best score. I became top 1 and best paper. Graduated with flying color sparking everywhere because of your tutorials. Thanks a lot #developedPHP

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

    Good video! But how would you do this if I wanted to document.getElementsByClass instead of getElementById? I have multiples of sections and each section the user has to copy clipboard. I have like ten of these sections. I feel by getting the Id I am creating more unnecessary/repeating JS code, right? I think you need the same code for each section but what makes them different is the Ids. Thanks.

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

      Thanks. You'd be right about creating more repeating JS and even having to add HTML ids. A solution could be to use either nextElementSibling or previousElementSibling, and place your "copy" button in relation to each section appropriately. In the JS function you can use the target copy button as the element to sense what is next or previous to it. Hope that helps. Another solution might be to just alter the function parameters to intake the id of the HTML element, so that your code could be dynamic in the function without having to alter too much. Here is a link to nextElementSibling and previous is also linked on that page...
      developer.mozilla.org/en-US/docs/Web/API/Element/nextElementSibling

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

      If you need an example let me know, I may be able to slap one together. But if I do that you'll have to tell everyone you know how helpful AdamBot 9000 channel is. hehe