2016-09-14 10 views
0

私はSharePointの2013年調査に別のテキストを置き換えると、問題に直面している:jQueryの/のSharePoint 2013のテキスト置き換え問題

survey checkbox

私はこのテキスト交換したいと思います:"marshmellows""Specify your own value:"を。

残念ながら、このコードは機能しません。私はSPとjqueryのノブです。私はこの記事に基づかた :ここでは jQuery find and replace string

は私のコードは次のとおりです。すべての

$(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>

答えて

0

まず、$(document.body)が間違っているようです。 $(body)または$(document body)を使ってみてください。それに失敗すると、$( "#s4-workspace")を試すことができます。これは、Sharepointで使用されるボディコンテナのIDです。

関連する問題