I want to be able to bold and underline on button click, but only apply to the text that is highlighted in a textarea. I've seen some people use window.getSelection()
and I plugged it in but it wasn't working. I'll show you what I'm dealing with.
function bold() {
var selection = window.getSelection()
selection.style.fontWeight = "bold"
}
<textarea id="theType"></textarea>