Here is the line I'm tring to remove the but keep the innerHTML.
<H3 style="TEXT-ALIGN: justify" class="ms-standardheader ms-WPTitle"><A accessKey=W href="/Lists/CACSurveys"><NOBR><SPAN>My Open Surveys</SPAN><SPAN id=WebPartCaptionWPQ1></SPAN></NOBR></A></H3>
End result should look like this:
<H3 style="TEXT-ALIGN: justify" class="ms-standardheader ms-WPTitle"><NOBR><SPAN>My Open Surveys</SPAN><SPAN id=WebPartCaptionWPQ1></SPAN></NOBR></H3>
Reason for this is SharePoint wont let me have web part headrs without links. Thanks in advance!
You can use jQuery to select the anchor tag <a>
, and then replace its parent's contents with its own contents. That will get rid of the anchor tag and keep everything else:
$(function() {
$('h3 a').each(function() {
$(this).parent().html($(this).html());
});
});
In action: http://jsfiddle.net/natecook/JTsKY/
嗯...您可以只使用unwrap()
:
$('h3 a').children().unwrap();
try this
$('.ms-WPTitle').find('span').each(function(){
$(this).unwrap();
});
hope it helps
我最终使用
$('h3.ms-WPTitle > a').replaceWith(function() { return this.innerHTML; });
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.