Hi guys,
I want to check the text input to see if it is in all caps.
This needs to be client-side not server side so I'm using
JS.
I can't get it to work. My
JS skills aren't that bad but I've never used regex with it.
Here's my code.
- HTML: Select all
<html>
<head>
<script type="text/javascript">
function caps(str) {
if(str.test(/[A-Z]+/)) {
alert("Upper Case");
}
}
</script>
</head>
<body>
<form action="">
<input type="text" onchange="caps(this)" />
</form>
</body>
</html>