动态句子中的逆序词 [英] Reverse order words in a dynamic sentence
本文介绍了动态句子中的逆序词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几个这样的标签:
<a class="classCover" href="#">1 Comment</a>
我想颠倒单词的顺序:
Comments (1)
我的功能是这个,但是不起作用:
My function is this but is not working:
$('.classCover').each(function(){
$(this).text().split(' ').reverse().join(' ');
});
请问有什么想法吗?
推荐答案
除了您对结果不做任何事情之外,您几乎都拥有了它
You almost had it, except you're not doing anything with the result
$('.classCover').each(function(){
$(this).text($(this).text().split(' ').reverse().join(' '));
});
这篇关于动态句子中的逆序词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文