Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

help with $(this).val() toUpperCase()

Tags:

jquery

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

like image 531
Rod Avatar asked May 11 '10 17:05

Rod


People also ask

Which built in method returns the calling string value converted to lower case?

toLowerCase() method returns the calling string value converted to lower case.


1 Answers

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

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

like image 70
karim79 Avatar answered Dec 13 '22 16:12

karim79