I've tried to answer your question in a fiddle: http://jsfiddle.net/vcarluer/Rfw3t/
The idea: show an html input when clicking on current header to enable text selection by user.
<li id="li-1"><a id ="a1" href="#fragment-1">Nunc tincidunt</a>
<div id="divText-1" class="tabText">
<input id="input-1" size="13" readonly/>
</div>
<button id="copyToClipBoard-1" class="ccButton">cc</button>
</li>
$("#a1").click(function(e) { if (selected == 0) { $("#divText-1").show(); $("#input-1").val("Nunc tincidunt"); $("#input-1").focus(); } selected = 0; });
$("#input-1").blur(function(e) { $("#divText-1").hide(); });
If you open it with IE you will find too a 'cc' button to copy header to clipboard (only work with IE)
var headerText = $("#a2").text();
window.clipboardData.setData('text', headerText);
I am not good with javascript and too lazy so I let you refactor code and function call because there are a lot of copy paste code.
You can remove input border too and align it correctly, or not... I let the border for you to see the input and div overlay.
Css is bad too but you have the idea.
I hope it will help you.