sigmaxf
sigmaxf

Reputation: 8482

Simple WYSIWYG not working, reason unknown

My wysiwyg stopped working and I can't find what's causing the problem, here is a fiddle showing the basic (not working) behavior..

http://jsfiddle.net/z5LL2n6n/

The basic code is:

<div class="icon-italic" onclick="document.execCommand('italic',null,false);">ITALIC</div>

Can someone help?

Upvotes: 1

Views: 45

Answers (1)

thgaskell
thgaskell

Reputation: 13226

You should try change the click elements to be button instead of div. When you click the div, it deselects the text so there's nothing to highlight.

http://jsfiddle.net/z5LL2n6n/1/

<button class="icon-bold" onclick="document.execCommand('bold',null,false);">BOLD</button>
<button class="icon-italic" onclick="document.execCommand('italic',null,false);">ITALIC</button>

Upvotes: 4

Related Questions