views:

1678

answers:

1

Need to insert selected text in the page into textarea. There must be some button to do it.

A: 
<script type="text/javascript">
$(document).ready(function() {
 $(".clickme").click(function() {
    $("textarea#textarea").html($(this).html());
    return false;
});
});
</script>
</head>

<body>
  <a href="#" class="clickme">hello</a>
  <textarea id="textarea"></textarea>
</body>

Where #clickme is the class of link being clicked textarea has the id of textarea and assuming that the text you want is the text of the link.

Phil

Phil Carter
this not works, adds "hello" after clickin on "hello" link. I need to insert the selected text, after clicking on "hello".
Mike