Skip to content

Instantly share code, notes, and snippets.

@toddwprice
Created November 29, 2013 23:39
Show Gist options
  • Save toddwprice/7713409 to your computer and use it in GitHub Desktop.
Save toddwprice/7713409 to your computer and use it in GitHub Desktop.
In accordance with the state of Ohio's boycott of the letter that must not be named, I have created this helpful script to rid your language of all traces of alluded letter.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<textarea id="my-text" style="width:600px;height:100px;">The whole state of Michigan should be on maximum alert.</textarea><br/>
<button onclick="ScarletLetter();">Strike Out Bad Letters</button>
<div id="result" style="margin-top:20px;"></div>
<script type="text/javascript">
function ScarletLetter()
{
var myText = document.getElementById('my-text').value;
var scarletLetter = '<div style="background:#A9000F;width:12px;height:16px;display:inline-block">&nbsp;</div>';
myText = myText.replace(/m/g, scarletLetter);
myText = myText.replace(/M/g, scarletLetter);
document.getElementById('result').innerHTML = myText;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment