0

I have faced a problem with replacing one text to another on my SharePoint 2013 survey:

survey checkbox

I would like to replace this text: "Specify your own value:" with "marshmellows".

Unfortunately this code doesn't work. I am a noob with SP and jquery. I was basing on this article: jQuery find and replace string

Here is my code:

$(document.body).find('*').each(function() {
    var tmp = $(this).children().remove();
    var text = $(this).text();
    text = text.replace("Specify your own value:", "marshmellows");
    $(this).text(text);
    $(this).append(tmp);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
  <div>
    <p>
      <h1>
        <a>Specify your own value:</a>
      </h1>
    </p>
  </div>
Community
  • 1
  • 1

1 Answers1

0

First of all, $(document.body) seems wrong. Try just using $(body) or $(document body). Failing that, you can try using $("#s4-workspace"), which is the id of the body container used in Sharepoint.

tigerdi
  • 612
  • 7
  • 13