pasteHTML using JQuery?

pasteHTML using JQuery?


Hi All,
Try the example javascript given in this link in IE and Firefox.
http://www.java2s.com/Code/JavaScript/Node-Operation/pasteHTMLExample.htm
html>
<body>
<script language="JavaScript">
function function1() {
var myRange = document.selection.createRange();
var m = myRange.pasteHTML('

Hello World

');
}
</script>

Highlight a part of this text, then click button below


<input id="myB" type="button" value="Click me" onclick="function1();">
</body>
</html>
Its works only in IE and not in Firefox.
Using JQuery can we get the selected text?
Is there is any Firefox equivalent coding to achieve the same
functionality which is working good in IE?
Thanks in advance.