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?