I an creating a project where people can create posts. I have a text editor I'm creating for this section. I need to make text uppercase if user clicks a button. All these other buttons work with execommand but there isnt an option for uppercase. My question is there an alternative I can use to do this?
Javascript
function headBold() {
document.execCommand('styleWithCSS', false, true);
document.execCommand('bold',false,null);}
function headItalics() {
document.execCommand('styleWithCSS', false, true);
document.execCommand('italic',false,null);}
function headUndLne() {
document.execCommand('styleWithCSS', false, true);
document.execCommand('underline',false,null);}
function headuppercase() { }
HTML
<button type="button" onclick="headBold();" class="bolden">B</button>
<button type="button" onclick="headItalics();" class="italics"><i>I</i></button>
<button type="button" onclick="headUndLne();" class="underline">U</button>
<button type="button" onclick="headuppercase();" class="upperCase">Tt</button>
This is being used in a content editable div not an input. Please no JQuery. The effect I'm looking for is the same one in CSS.
font-variant: small-caps;