Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder levani's Avatar
    Join Date
    Mar 2009
    Location
    Georgia
    Posts
    183
    Thanks
    29
    Thanked 1 Time in 1 Post

    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?

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    Did you call .autoResize() before or after the forms have been added dynamically?

  • #3
    Regular Coder levani's Avatar
    Join Date
    Mar 2009
    Location
    Georgia
    Posts
    183
    Thanks
    29
    Thanked 1 Time in 1 Post
    I call it once on page load...

    Code:
    $(document).ready(function() {
        $('textarea.text').autoResize({limit : 300});
    });

  • #4
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    You'll have to call it (again) after the additional elements have been added. Otherwise autoResize can not know anything about them.

  • Users who have thanked devnull69 for this post:

    levani (03-28-2011)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •