tags:

views:

66

answers:

2

Hi All,

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

+4  A: 
 $('#stringFinder').keyup(function (e) {
     alert($(this).val().toUpperCase() == str.toUpperCase());
 });
Alexander
+3  A: 

$(this).val() returns a String object, which means you perform any String methods on it, so:

alert($(this).val().toUpperCase() === str.toUpperCase());

karim79
Wasn't getting the intellisense in vs2010 after the .val(). I should have just tried it, eh? thanks for the help, rod.
rod