Hi,
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.
Thanks
-------------------------------
## @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
<script>
AJS.toInit(function ($) {
jQuery(".label_to_add").click(function(){
jQuery.post(contextPath+"/json/addlabelactivity.action", {"entityIdString": "$content.id", "labelString": jQuery(this).val(), "atl_token": jQuery("#atlassian-token").attr("content") },function(){
window.location.reload();
});
});
});
</script>
<button class="label_to_add" type="submit" color="#0" value=$param0>$param1</button>
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.