Created
March 4, 2021 20:30
-
-
Save Faldrian/6ede1550bcdc622c89d0fa62e21b74eb to your computer and use it in GitHub Desktop.
Little helper for figuring out anagrams...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<p>Pool: <input id="buchstaben"></p> | |
<p>Verbleibend: <span id="pool"></span></p> | |
<p><input id="genutzt"></p> | |
<script type="text/javascript" > | |
let genutzt = document.getElementById('genutzt'); | |
let buchstaben = document.getElementById('buchstaben'); | |
let pool = document.getElementById('pool'); | |
genutzt.addEventListener('input', function () { | |
var pool2 = buchstaben.value.toUpperCase(); | |
pool.style = ''; | |
for (var x = 0; x < genutzt.value.length; x++) | |
{ | |
var c = genutzt.value.charAt(x).toUpperCase(); | |
if(buchstaben.value.indexOf(c) < 0) { | |
pool.style = 'color:red'; | |
} | |
pool2 = pool2.replace(c, ''); | |
} | |
pool.innerHTML = pool2; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment