$('#note_{PAGER_NAMESPACE}_{PAGER_XID}_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} = new WB.Ajax.Comment() .setElement($(".comment.comment-{PAGER_NAMESPACE}-{PAGER_XID}")[0]) .setNamespace("{PAGER_NAMESPACE}") .setXid("{PAGER_XID}") .setShowForm({PAGER_SHOWFORM}) .useAutosave();