【发布时间】:2014-12-04 16:22:54
【问题描述】:
我现在有一个文本包装器,这仅适用于同名的第一个 div,但我的代码会根据新消息自动创建此 div。
如何让它与所有其他同名的 div 一起使用?
$(document).ready(function(){
var content=$(".reply_message").html();
var description=content.substr(0,100); //first 140 characters allowed to show
$(".reply_message").html(description+"...");
$("#show").on("click",function(){
var more=$("#show").html();
if(more=="Show more")
{
$("#show").html("Show less");
$(".reply_message").html(content);
}
else
{
$("#show").html("Show more");
$(".reply_message").html(description+"...");
}
});
});
【问题讨论】:
标签: jquery