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

Inject String into AJS/JQuery in User Macro


I'm  trying to figure out how to inject a string into the portion in bold: "jQuery(".label_to_add").click(function(){".  This macro currently work injecting a label to the page by click of a button; however, if more than one page with this macro is included into another, the ".label_to_add" triggers the scripts in multiple pages.  I need to make each of these scripts unique.



## @Param 0:title=Label to add|type=string|desc=Label of interest
## @Param 1:title=Button description|type=string|desc=Text to display on button

AJS.toInit(function ($) {
jQuery(".label_to_add").click(function(){"/json/addlabelactivity.action", {"entityIdString": "$", "labelString": jQuery(this).val(), "atl_token": jQuery("#atlassian-token").attr("content") },function(){
<button class="label_to_add" type="submit" color="#0" value=$param0>$param1</button>

0 answers

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...

75 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