It works with JQuery, but not AJS

robert_egan_305 March 30, 2020

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
AUG Leaders

Atlassian Community Events