Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

NEED example of a user macro that print a Javascript variable into the body

I can't print in the body with "document.write()" or "innerHTML" when I'm using a variable (With out the variable works). Any idea how to do it?

2 answers

0 votes

Hello Medios,

If I understand correctly, you’re wanting to create a user macro within Confluence that has javascript within it that returns variable values as content or body of the macro itself when its placed within a Confluence page.

To understand a bit more on what you’re attempting to do exactly, could you please share the user macro you have so far that's not returning the variable? This would allow us to examine and test the macro to see if this is possible and where the issue may be.

We look forward to your response so we may help to find a solution for you.

Stephen Sifers

I did this by adding an empty div and building the innerHTML in script:



//Update Page Id Displayer
document.getElementById("pageIdDisplayer").innerHTML = displayStr;



<div style="text-align:right; font-size:x-small;" id=pageIdDisplayer></div>

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

82 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you