1

I am working in sharepoint and using a 'content editor' to embed HTML hyperlinks on the page.

<a href="/New%20Applications.aspx">New Applications</a>

Now I would like to somehow get the total number of items from that list and display the number in brackets in the hyperlink, ie

New Applications(5)

I am familiar with using javascript on a SharePoint page and can get the value, but how would I then use javascript (if I should use JS) to add the value found to the hyperlink text?

Appreciate any assistance!

2 Answers 2

1

If you give the hyperlink an ID (you would end up with <a id="someID" href="...">New Applications<a> you can use this code:

 document.getElementById('someID').innerHTML += value;

This will append whatever is in value to the end of "New Application"

Sign up to request clarification or add additional context in comments.

Comments

0

If you can get the number of applications in a variable, let's call it newApps, then:

<a href="/New%20Applications.aspx">New Applications (<script>document.write(newApps);</script>)</a>

1 Comment

I didn't get a chance to try your solution, since David's worked without problem, but thank you for the suggestion. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.