I am trying to create an editing page where a user can edit their content in a text box to fit the content, and I use this plugin to do this: http://www.jacklmoore.com/autosize/
But when I access the edit page, the text box does not resize to fit the content, this only happens if I refresh the page manually. Here is the code:
<template name="postEdit">
<textarea autofocus name="content" type="text" value="">{{content}}</textarea>
</template>
Template.postEdit.rendered = function() {
$('textarea').autosize();
};
I also tried with Meteor.defer, but it does not work:
Template.postEdit.rendered = function() {
Meteor.defer(function() {
$('textarea').autosize();
});
};
When I refresh the page manually and the text box finally resizes, the html text environment changes for this:
<textarea class="review" name="review" type="text" value="" placeholder="Blablabla" style="overflow: hidden; word-wrap: break-word; resize: horizontal; height: 664px;"></textarea>
Are there any problems with my code or is my approach wrong?
Thank.