获取标签里的纯文字内容
Posted myyouzi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取标签里的纯文字内容相关的知识,希望对你有一定的参考价值。
<div class="js-text">test<span>subtest</span></div>
<script type="text/javascript">
$(function()
var text = $(‘.js-text‘).contents()[0].data;
console.log(text); //输出test
);
</script>
以上是关于获取标签里的纯文字内容的主要内容,如果未能解决你的问题,请参考以下文章