I have this text editor which i created using jquery with execCommand and a div with contenteditable but some on it isn't working only the undo and redo is working. This is my code
<li data-role="bold" class="bold_str"><span><i class="fa fa-bold"></i></span></li>
<li data-role="strikeThrough" class="strike_str"><span><i class="fa fa-strikethrough"></i></span></li>
<li data-role="underline" class="underline_str"><span><i class="fa fa-underline"></i></span></li>
<li data-role="undo" class="undo_str"><span><i class="fa fa-undo"></i></span></li>
<li data-role="redo" class="redo_str"><span><i class="fa fa-redo"></i></span></li>
<div class="output_wp">
<div class="output" id="output" contenteditable></div>
</div>
<script>
$('li[data-role]').click(function () {
document.execCommand($(this).data("role"), false);
})
</script>
The bold, strikethrough and underline does not work when i highlight the text in the contenteditable div and click the li button
What do i do here cause console doesn't show any error and also whenever i click the li the highlight disappears and nothing will happen