0 words
0 characters
');
printWindow.document.close();
printWindow.print();
});// Text formatting
boldBtn.addEventListener("click", () => document.execCommand('bold'));
italicBtn.addEventListener("click", () => document.execCommand('italic'));
underlineBtn.addEventListener("click", () => document.execCommand('underline'));
});function changeCase(type) {
const textInput = document.getElementById("textInput");
let text = textInput.innerText;switch (type) {
case 'sentence':
text = text.toLowerCase().replace(/(^\s*\w|[\.\!\?]\s*\w)/g, function(c){ return c.toUpperCase() });
break;
case 'title':
text = text.toLowerCase().replace(/\b\w+/g, function(c){ return c.charAt(0).toUpperCase() + c.slice(1); });
break;
case 'upper':
text = text.toUpperCase();
break;
case 'lower':
text = text.toLowerCase();
break;
}textInput.innerText = text;
}