I have to replace Text inside HTML. When I looked ViewSource of the page I found this html tag. Now I need to replace text "Respuesta" with "Responder". I am using SharePoint CEWP webpart for this. What is the code I need write to replace this text?
<div><a id="ReplyLink3" href="" ONCLICK="javascript:GoToPage('');return false;" target="_self"><img id="replyButton" border="0" align="middle" alt="Respuesta" src="/_layouts/images/reply.gif"> <NOBR><b>Respuesta</b></NOBR>&l开发者_高级运维t;/a><
You asked specifically for jQuery, so here it is in jQuery ssuming there is no other bolded text. Uses the Next Siblings Selector. Only works if there are no more <b>
items as children of the div.
$(document).ready(function() {
$("$replyButton ~ b").text("Responder");
});
Another approach using replace() JavaScript method:
$('#ReplyLink3').parent().html( $('#ReplyLink3').parent().html().replace(/Respuesta/gi,'Responder') );
You may need to optimize the selectors but this may be what you are looking for:
.replace(/Respuesta/gi,'Responder')
精彩评论