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
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.
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
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
One of the things that usually would've required me to google it.
Although pretty quick, I really much appreciated this video! :)
Glad to hear that Pascal. Thanks for the comment.
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
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.
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
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