bgrins / ExpandingTextareas

jQuery plugin for elegant expanding textareas
http://bgrins.github.com/ExpandingTextareas/
MIT License
261 stars 73 forks source link

Textareas don't resize after changing content with $textarea.val(" ... ") #30

Closed iamdanfox closed 11 years ago

iamdanfox commented 11 years ago

Could we solve this by listening to the 'change' event?

bgrins commented 11 years ago

I don't see any problem with adding change to the listeners. Can you file a PR?

On Sep 14, 2013, at 1:30 AM, iamdanfox notifications@github.com wrote:

Could we listen to the 'change' event too?

— Reply to this email directly or view it on GitHub.

iamdanfox commented 11 years ago

This doesn't completely solve the problem (as discussed in issue #23) but it does make the usage simpler.

You can now silently update content with $('textarea').val('new content') and trigger resizes with $('textarea').val('more new content').change().

This behaves the same as the following:

$('textarea').val('even more content').expandingTextarea('resize')

Examples: http://jsfiddle.net/CnRhG/ and http://jsfiddle.net/CnRhG/1/

Could we include this in the README?

bgrins commented 11 years ago

Yes, we can definitely add this to the README. So you are saying that with this commit, you will be able to do:

$('textarea').val('more new content').change()

I think that is an improvement over the current syntax.

iamdanfox commented 11 years ago

Yep, that's right. You can play with it in the jsfiddle if you like