On a SharePoint landing page I have several CQWP that place an ID multiple times in the DOM. I want to access the second and only the second ID called hiddenArea.
I can’t change the control in any fashion and I need to use javascript code below modified with the fix as a solution.
<script type="text/javascript"> var a = document.createElement('a'); var linkText = document.createTextNode("My Assignments"); a.appendChild(linkText); a.title = "My Assignments"; a.href = "/ourcompany/departments/insretsol/grpptr/Lists/TDM%20Select%20an%20Assignment/Applicant%20View.aspx"; a.className += "noContentLink" document.body.appendChild(a); document.getElementById('hiddenArea').appendChild(a);</script> <style type="text/css"> .hiddenAreaContainer{ /*padding:5px;*/ display:inline-block !important; text-align:center !important; } .noContentMsg{ /*text-align:right !important;*/ }</style>