Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在字符数超过 X 时切断一个元素,然后添加一个链接以将其扩展回来。
我在这里有工作脚本:JSFiddle
问题是,当单击“阅读更多”链接时,前一个链接会substr立即将其切断。
substr
我怎样才能做到这一点,它不会打败自己?
如果您更改,您的代码可以正常工作:
$(object).text() = text;
至:
$(object).text(text);