TH71 Posted October 17, 2019 Share Posted October 17, 2019 Hi Is it possible to have more than one Copy To Clipboard (Copy Text) buttons on one page without any conflicts? eg, Copy Text button 1 - Hello World Copy Text button 2 - Hi World Copy Text button 3 - Hello People and so on https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_copy_clipboard2 Thanks🙂 Link to comment Share on other sites More sharing options...
Ingolme Posted October 18, 2019 Share Posted October 18, 2019 Yes, there's nothing preventing you from using execCommand() in more than one place. Link to comment Share on other sites More sharing options...
TH71 Posted October 22, 2019 Author Share Posted October 22, 2019 Thanks for the reply With what you say, does anything need changing in the example to make this work? Not sure here at all, but do the Text to be copied need their own id's/separate code to make it work? Copy Button 1 - Hello World (as in the Demo) <input type="text" value="Hello World" id="myInput"> <div class="tooltip"> <button onclick="myFunction()" onmouseout="outFunc()"> <span class="tooltiptext" id="myTooltip">Copy to clipboard</span> Copy text </button> </div> So if I want to add two more Copy Text buttons Copy Text Button 2 - Hi World Copy Text Button 3 - Hello People Do these need their own code? Thanks🙂 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now