Thanks fir the reply, but it doesn't work completely.
I've tried it like
Code:
<li onclick="injectString( this.innerHTML);">½</li>
Code:
function injectString(str){
var sel=frames[0].getSelection()
var nd=sel.anchorNode;
var txt=nd.data+'';
var pos=sel.anchorOffset||0;
sel.anchorNode.data=txt.slice(0,pos)+str+txt.slice(pos);
}
Edit: It inserts ½ to the iframe, when there's something already typed there.
Looks like, it doesn't insert the symbol to the end of what originally typed. I need to either select some text or put the cursor in between two characters to get it work.
Edit: Also, it moves the cursor to the beginning of the typing area, after button click
I've updated the demo page at
http://itsnot.freehostia.com/wysihtm...ihtml5-new.htm