User comment looks something like this:
<div id="comment23" class="commentholder">
<p>
This is a sample comment. It may contain different kinds of html.
like <strong>strong text</strong>
or anything that markdown supports.
</p>
</div>
When text in comment23 div is selected, I would like to display a button near it. If button is pressed I want to take the selected text, prepend ">" to each line (to make it blockquote in markdown) and paste it in an input box.
How can I achieve this in javascript, preferably jquery?