<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>
原文地址:https://www.cnblogs.com/myyouzi/p/11508229.html
时间: 2024-11-10 16:56:10