I am almost done creating a simple text editor. User can write on an Iframe and change text style to bold, italic, etc. But i cant do the same to heading. I would like to know how can I allow users to click on a button and switch from italic/bold to heading (h1, h2, h3, h4, etc).
What I tried so far:
window.addEventListener("load", function (){
var editor = wysiwyg.document;
editor.designMode = "on";
boldButton.addEventListener("click", function (){ editor.execCommand("Bold");}, false)
italicButton.addEventListener("click", function (){ editor.execCommand("Italic");}, false)}, false);
When user clicks the bold btn the text turn bold. How can I implement the same so can user clicks the btn, the text turns to be heading h1 or h2?