var maxLen=145; var str=$("#contentbox").val(); $("#contentbox").val(str.split(maxLen+1,str.length-1)[0]);