Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Document Fragment, ejs, jQuery-plugin, width and height

$
0
0
Hello,

I have a jQuery-plugin that makes textarea's grow automatically when you type.

The plugin creates and shadow-div with the same width as the textarea on initialisation.
the content of the textarea is copied into the shadow div and then the height of the textarea is matched with the height of de shadow div.
Now because of live-binding in this textarea I have to set the plugin within the ejs-file.
  1. <textarea <%= (el) -> el.autogrow(); %>><%= model.attr('subject') %></textarea>
This works fine in Chrome but in Firefox and Safari the width of the shadow-div is 0 because Firefox and Safari can't find the width within a document Fragment.

How can I solve this?

P.S. When I attach the jquery plugin to the textarea outside of the ejs-file it also doesn't work because the textarea is rewritten everytime live-binding kicks in!



Viewing all articles
Browse latest Browse all 3491

Trending Articles