troubleshooting Question

Jquery autoresize

Avatar of Abrasax7
Abrasax7 asked on
JavaScript
9 Comments1 Solution900 ViewsLast Modified:
Hey guys, thanks for helping me out
this is probably a really simple question, but im a newbie with js so here goes.

I want to use this autoresize plugin http://james.padolsey.com/javascript/jquery-plugin-autoresize/ 

I downloaded the script, put it in my JS folder and pointed to it in my header like this: <script type="text/javascript" src="{$smarty.const._URL}/js/autoresize.jquery.js"></script>

now how can i make the textarea in the following form autoresize, i.e where do i need to add/change code.

====================form on my site =========================

                        <form action="" name="myform" method="post" id="myform">
                  <input type="hidden" id="c_username" name="username" value="Anonymous" class="inputtext" /><br />
                  <span style="color: #8c8c8c;">{$lang.your_comment}:</span><br />
         
                  <textarea id="c_comment_txt" name="comment_txt" style="width:470px" rows="5" onkeyup="textLimit(this, 400);"></textarea><br /><br />
                  <input type="hidden" id="c_vid" name="vid" value="{$uniq_id}" />
                  <input type="hidden" id="c_user_id" name="user_id" value="0" />
                  <br />
                  <input type="submit" id="c_submit" name="Submit" value="{$lang.submit_comment}" class="inputbutton" />

====================/ form on my site =========================

on the plugin homepage it says that this is an example implementation:

====================Example implementation =========================

$('textarea#comment').autoResize({
    // On resize:
    onResize : function() {
        $(this).css({opacity:0.8});
    },
    // After resize:
    animateCallback : function() {
        $(this).css({opacity:1});
    },
    // Quite slow animation:
    animateDuration : 300,
    // More extra space:
    extraSpace : 40
});
====================/ Example implementation =========================

but where do I add this?


again, thanks for the help :)

~Abrasax7
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros