Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Teams
, (opens new window)

One Appfire Support Knowledge Base
Results will update as you type.
  • License-related documentation
  • Product Categories
    • Administrative Tools
    • BI and Reporting Apps
    • Publishing
      • Linking for Confluence
      • LaTeX Math - Knowledge base
      • Polls for Confluence - FAQs
      • Bolo Software Knowledge Base [DOCB]
      • Artemis kb articles.
      • Snippets for Confluence
      • Source Editor for Confluence
      • Spacetree for Confluence
      • Polls for Confluence
      • Image Slider for Confluence
      • News Teaser for Confluence
      • Markdown Extensions for Confluence
      • Github Macros for Confluence
      • Custom Dashboards for Confluence
      • Numbered Headings
      • HTML for Confluence
        • FAQs for the HTML for Confluence app
        • How to change URLs embedded in a HTML macro through database
        • Render restricted Vimeo videos in the HTML(cloud) macro
        • How to retrieve usage information of HTML for Confluence
        • How to resolve the page not rendering properly for HTML macro
        • How to Embed Google Calendar within HTML macro in confluence page
        • How to render Latex code with HTML in a Confluence page
        • How to embed an Issue Collector from Jira Cloud into Confluence Cloud
        • Migrating the content from the HTML Elements Server app to the HTML for Confluence Cloud app in Server/Data Center
        • How to auto-select HTML macro contents in Confluence cloud
        • Steps for Migrating to HTML for Confluence App data from one Cloud instance to another Cloud instance
        • How to check in logs if 'Allow Javascript' is enabled or disabled in the HTML for Confluence app
        • Issues faced during the macro naming conversion of HTML for Confluence App during the pre-migration process
        • Troubleshooting Server/Data Center migration issue for HTML for Confluence app stuck at 0%
        • Migration best practices for HTML for Confluence app from DataCenter to Cloud
      • Markdown for Confluence (MARKDOWN)
      • Flash for Confluence (FLASH)
      • Wiki Markup for Confluence (CWP)
      • Visio for Confluence (CVP)
      • Cache for Confluence (CACHE)
      • Composition Tabs for Confluence
      • Visibility for Confluence
    • Agile
    • Document Management
    • ITSM
    • Developer Tools
    • Workflow & Automation
    • Integrations KB's
  • Migration Support
  • General Articles
  • KB [KBS]
  • Mohami Support Knowledge Base [SUPPORTM]
  • Feedthree Support [SUPPORTFT]
  • KB : Articles
  • Bob Swift Support Knowledge Base [SUPPORTS]
  • Wittified Support Knowledge Base [SUPPORTW]
  • Digital Toucan Knowledge Base
  • Knowledge Base
  • QotiLabs Knowledge Base
  • Untitled Smart Link (3)
  • SAFe EPIC to Feature Translator for Jira
  • How do I find the SEN (Support Entitlement Number) for an Appfire app in the Server / Data Center Platform?
  • Power Scripts DC: How to hide Tempo work attributes in the Tempo UI?
    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    How to auto-select HTML macro contents in Confluence cloud
    Updated Feb 28, 2023

    How to auto-select HTML macro contents in Confluence cloud

    This article explains how a user can copy the contents from the HTML macro in a confluence page with an option/button with an HTML script.

     Instructions

    • Create a confluence page in the cloud environment & add an HTML macro.

    • Add the below code to your HTML content:
      The content can be modified as per your requirement. Here in the snippet, replace the value parameter with the one you want to show to the user under the “Add the content you want to see“ section.

      <!-- HTML code to copy into clipboard --> <!-- Include libraries --> <!-- a. Include font-awesome for the copy icon --> <head> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- b. Include the copy library <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script> --> <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.10/clipboard.min.js"></script> <!-- Instantiate clipboard by passing a string selector --> </head> <body> <!-- test --> <input id="foo" value="bam -i |grep byn > /tmp/mpplist_alive || grep byn /etc/opt/teradata/tdconfig/mpplist|awk '{print $1}' > /tmp/mpplist_all"> <!-- Trigger --> <button class="btn" data-clipboard-target="#foo"> <img src="assets/clippy.svg" alt="Copy to clipboard"> </button> <script>// Select elements const target = document.getElementById('foo'); const button = target.nextElementSibling; // Init clipboard -- for more info, please read the offical documentation: https://clipboardjs.com/ var clipboard = new ClipboardJS(button, { target: target, text: function() { return target.innerText; } }); // Success action handler clipboard.on('success', function(e) { const currentLabel = button.innerHTML; // Exit label update when already in progress if(button.innerHTML === 'Copied!'){ return; } // Update button label button.innerHTML = 'Copied!'; // Revert button label after 3 seconds setTimeout(function(){ button.innerHTML = currentLabel; }, 3000) }); </script> </body>
    • Publish the page to see the result.



    • Please ensure, the HTML for confluence app is installed in your environment.

    • Ensure to have proper permission to perform/apply changes.

    {"serverDuration": 16, "requestCorrelationId": "13fd357ac3ab472aa7edf46634c3cca4"}