Below is the code snippet I am working with:
<div contenteditable="true" style="height:100px;width:100px;border:1px solid; " class="editor"></div>
<a class='bold' style="height:10px;width:10px;">B</a>
$(function(){
$("a.bold").on("click",function(){
document.execCommand('bold',false,true);
})
})
After clicking on the B link, the text in the contenteditable div did not become bold. You can view the jsfiddle example here: http://jsfiddle.net/JeremyHuang_Stern/487YF/
However, when using a button instead of a link to achieve the same effect, the issue was resolved. Here's the fiddle demonstrating this: http://jsfiddle.net/JeremyHuang_Stern/2QG26/
What could be causing this discrepancy?