Given:
<script type="text/javascript">
$(document).ready(function () {
var str = 'Test';
//alert(str.toUpperCase());
$('#stringFinder').keyup(function (e) {
alert($(this).val()==str.toUpperCase());
});
});
</script>
How do I make $(this).val() all upper case to get a like comparison using contains?
Thanks, rodchar
toLowerCase() method returns the calling string value converted to lower case.
$(this).val()
returns a String object, which means you perform any String methods on it, so:
alert($(this).val().toUpperCase() === str.toUpperCase());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With