JQUERY text interception method
< script type="text/javascript">
$.fn.substr = function(length,content){
$(this).each(function(i,item){
var val=$ (item).html();
if(!val) return;
if(val.length>length) {
val = val.substring(0,length);
val = content || "..."
$(item).html(val);
}
});
}
function subTdContent(){
$('td' ).substr(20);
}
< table style="border:1px solid #b3c0f5;" border="1">
My code: $.fn.substr = function(l,c){ $(this).each(function(i,item) |
The following two methods can solve the problem that the textarea row height automatically adapts to the height of the class content |
< ;td>The following two ways can solve the textarea row