目前的HTML:
link
text with addional dot at the ened to remove.
我需要删除.
文本节点中的最后一个.
试试这个:
$(function() {
$('span').contents().get().forEach(function(node) {
if (node.nodeType === Node.TEXT_NODE) {
node.textContent = node.textContent.replace(/\.\n$/, '')
}
});
});
link
text with addional dot at the ened to remove.