$('#note_{PAGER_NAMESPACE}_{PAGER_XID_JS}_textarea').bind('keyup', function(e){ var el = $(e.target); if (70 > el.val().length) { el.attr('rows', 3); return; } if (120 > el.val().length) { return; } el.attr('rows', 10); }); // init or reinit comment comment{PAGER_NAMESPACE}{PAGER_XID_JS} = new WB.Ajax.Comment() .setElement($(".comment.comment-{PAGER_NAMESPACE}-{PAGER_XID}")[0]) .setNamespace("{PAGER_NAMESPACE}") .setXid("{PAGER_XID}") .setLimit({PAGER_LIMIT}) .setShowForm({PAGER_SHOWFORM}) .useAutosave();