SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to change the "New Item" text into "Yeni Ekle". I viewed the source of the list from browser. Here is the part of the New Item;

<a id="idHomePageNewItem" ...........>
  <span ...>
    <img id="idHomePageNewItem-img" ....></img>
  <span>  new item  </span>

And here is my code for change the text. But it doesn't work. Why doesn't it work?


<asp:content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
    <SharePoint:RssLink runat="server"/>
    <SharePoint:scriptlink ID="ScriptLink" Name="SP.js" runat="server" OnDemand="true" Localizable="false"></SharePoint:ScriptLink> 
    <script type="text/javascript" src="/../../../Style Library/SolidQ-SPS-JS.js"></script>
    <script type="text/javascript">
        function ChangeText() {
          document.getElementById('idHomePageNewItem').getElementsByTag("span")[1].innerHTML="Yeni Ekle";
share|improve this question
up vote 2 down vote accepted

Try change getElementsByTag to getElementsByTagName as that is the valid Javascript DOM selector

share|improve this answer
It worked finally.. Thank you – e.ozmen Mar 15 '13 at 9:34

There could be multiple reasons, either your javascript is executing before the control text has been rendered, or your selection method is not correct.

Have you tried triggering the function manually after the page has fully loaded from the console?

share|improve this answer
Doesn't $().ready trigger the function? – e.ozmen Mar 15 '13 at 8:30
Well it does, but it has a tendency in sharepoint to trigger before all sharepoints javascript functions has executed. I usually use ExecuteOrDelayUntilScriptLoaded() and specify sp.js or sp.ui.socialribbon.js as the script to wait for just to make sure – Robert Lindgren Mar 15 '13 at 8:37
I updated the javascript part. It doesn't work. Did I write it wrong? – e.ozmen Mar 15 '13 at 8:47
Yes, you should only write the functions name as the first parameter in ExecuteOrDelay.. Like ExecuteOrDelayUntilScriptLoaded(ChangeText,"sp.js"); – Robert Lindgren Mar 15 '13 at 8:50
Should I import anything for sp.js? – e.ozmen Mar 15 '13 at 8:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.