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?
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.
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!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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.