这是我现有的工作。我将它限制为最多30个字符,但是当字符超出限制时,如何动态地添加更多链接到我的其他页面?我需要你的帮助。
var myDiv = $('.wwdtext');
myDiv.text(myDiv.text().substring(0,30))
<div style="background-color:#FF6201;width:220px;height:220px">
<div class="wwdtext">Hello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello World</div>
</div>
答案 0 :(得分:0)
var myDiv = $('.wwdtext');
myDiv.text(myDiv.text().substring(0,100))
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div style="background-color:#FF6201;width:220px;height:220px">
<div class="wwdtext">Hello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldeqwrewqjkfbsajHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldeqwrewqjkfbsajHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello WorldHello Worldeqwrewqjkfbsaj</div>
</div>
&#13;