get value from textarea and copy to a div
Basically I want to get the current value from a textarea field and copy to a div element on the page. Here is my HTML:
- <a href="#" class="desc-button">Edit</a>
- <div class="product-data"><?php echo $prod_description; ?></div>
-
- <form action="" method="post">
- <div class="product-form" style="display:none;">
- <textarea class="description" name="prod-desc"></textarea>
- <input type="submit" value="submit" />
- </div></form>
My JQuery code is as follows:
- $('.desc-button').click(function(){
- $('.product-form').slideToggle();
-
- var str = $('.product-data').html();
- $('.product-data').html(str);
-
- $('.product-data').slideToggle();
-
- return false;
- });
But this does not work. Note I need it to retrieve the current value - that is including any newly typed text in the textarea field.