$("selector").each(function() { if ($(this).text().length > 36) { $(this).text($(this).text().substr(0, 33)); $(this).append('(以下略'); } });