Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-28-2011, 06:55 PM   PM User | #1
levani
Regular Coder

 
levani's Avatar
 
Join Date: Mar 2009
Location: Georgia
Posts: 183
Thanks: 29
Thanked 1 Time in 1 Post
levani is an unknown quantity at this point
Jquery with dynamically added forms

I use jquery appendTo function to add new textarea forms dynamically and I also use jquery autoResize plugin to automatically change the height of the textarea while typing. Here is the code:

Code:
$('textarea.text').autoResize({limit : 300});
The problem is that the auto resize doesn't work with dynamically added forms! It works fine with other inline forms... Can anyone please tell what is the problem?
__________________
levani is offline   Reply With Quote
Old 03-28-2011, 07:09 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Did you call .autoResize() before or after the forms have been added dynamically?
devnull69 is offline   Reply With Quote
Old 03-28-2011, 08:28 PM   PM User | #3
levani
Regular Coder

 
levani's Avatar
 
Join Date: Mar 2009
Location: Georgia
Posts: 183
Thanks: 29
Thanked 1 Time in 1 Post
levani is an unknown quantity at this point
I call it once on page load...

Code:
$(document).ready(function() {
    $('textarea.text').autoResize({limit : 300});
});
__________________
levani is offline   Reply With Quote
Old 03-28-2011, 08:44 PM   PM User | #4
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
You'll have to call it (again) after the additional elements have been added. Otherwise autoResize can not know anything about them.
devnull69 is offline   Reply With Quote
Users who have thanked devnull69 for this post:
levani (03-28-2011)
Reply

Bookmarks

Tags
javascript, jquery

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:23 PM.


Advertisement
Log in to turn off these ads.