I am looking to create a button that toggles the text in a text area between bold and its previous state. This button should be able to switch back and forth with one click.
function toggleTextBold() {
var isBold = false;
if (isBold) {
// Code to unset text as bold
} else {
// Code to set text as bold
}
}
<button onclick="toggleTextBold()">TOGGLE BOLD</button>
<form>
Enter Text:
<br>
<input type="text" name="your text" id="entertext">
</form>