Does string appear in string

Does string appear in string

by Andrew Pougher

HTML

<link rel="stylesheet" href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css">
<script src="http://twitter.github.io/bootstrap/assets/js/bootstrap.js"></script>
<div class='row-fluid'>
<p><code>A1BCDEFGHIJ213KLMNOP*&^TGbnkb</code></p>
<p>Enter a search to see if it appears in the string</p>
<input type="text" name="searchit" id="searchit" value=""/><span class='btn'><i class='icon-search'></i></span>
<span class='result'></span>
</div>

JavaScript

$('.btn').on('click', function(){
    var str1 = "A1BCDEFGHIJ213KLMNOP*&^TGbnkb";
    str1 = str1.toLowerCase();
var str2 = $("#searchit").val();
    str2 = str2.toLowerCase();
if(str1.indexOf(str2) != -1 && str2.length > 1){
    $('.result').html('YEY! ' + str2 + " found in the string.");
}else{
      $('.result').html('not found')
}
});