Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

It works with JQuery, but not AJS

robert_egan_305 March 30, 2020 edited

The following code writes 'undefined' to the console log.

AJS.toInit(function(){

console.log(AJS.$("#spacesLink").prop("href"));

});

The same code in straight JQuery works as expected (note: The anchor element is copied directly from a Confluence page, I just put it in it's own HTML for simplicity)

<head>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<a id="spacesLink" href="/plugins/AttachmentReport/spaces.action?src=spacemenu">Download Attachment Report</a>

<script>
console.log($("#spacesLink").prop("href"));
</script>
</body>

  This anchor is in a "drop down" menu (web-item). If that is the issue, how do I work around it?

1 answer

1 accepted

0 votes
Answer accepted
robert_egan_305 March 31, 2020

I have decided to change my design. Instead of trying to use a javascript popup I am just going to create a web page with input fields and a submit button.

But if anyone wants to comment on the original issue (using javascript to modify the href of a drop down web-item), feel free.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence whiteboards, whiteboard templates, template contest, visual collaboration, atlassian learning, confluence community, brainstorming tools, agile planning, team productivity, confluence templates, share your template

Share Your Confluence Whiteboard Template for a Chance to Be Featured in the Product! 🏆

Want to leave your mark on Confluence? One winner will have their whiteboard design added into Confluence for all users to access! This is your chance to showcase your creativity, help others, and gain recognition in the Confluence community.

Share your template today!
AUG Leaders

Atlassian Community Events