I want to use execcommand 'formatblock' for select a line by 'p' tag or span with specific class or Id or any css style in my contenteditable div(own rich text editor). i searched a lot for this, but i could not find anything which valuable for me.
document.execCommand('formatblock', false, 'p');
How can i add class or id or css in this code?
If you want to add id or class for CSS in content editable div, then you will use below code---
<script>
function CssFnctn()
{
document.execCommand('formatblock', false, 'p')
var listId = window.getSelection().focusNode.parentNode;
$(listId).addClass("oder2");
}
</script>
.oder2
{
padding-left: 3em;
}