Created
August 9, 2019 20:20
-
-
Save aneury1/1f468c3725d725b00a0ad77a22d14da7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="rich_text_area"> | |
<iframe class="cl" id="editor" name="editor" frameborder="2" ></iframe> | |
</div> | |
... | |
<script src="script.js"></script> | |
<script> | |
window.onload=()=>{ | |
const editor = document.getElementById('editor'); | |
const doc = editor.contentDocument; | |
console.log(doc); | |
console.log(editor); | |
doc.designMode = "on"; | |
editor.contentDocument.designMode = "on"; | |
document.getElementById('boldBtn').addEventListener('click', ()=>{ | |
doc.execCommand("Bold", false,null); | |
}) | |
document.getElementById('ItalicBtn').addEventListener('click', ()=>{ | |
doc.execCommand("Italic", false,null); | |
}) | |
document.getElementById('html').addEventListener('click', ()=>{ | |
//doc.execCommand("Italic", false,null); | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment