Please help me with a question.
There is html with this structure (simplified):
<div id="data">
<div description="Andy">
<div class="ig"><a href="#"><img src="#"></a></div>
<div>Andy</div>
</div>
<div description="Cramly">
<div class="ig"><a href="#"><img src="#"></a></div>
<div>Crasly</div>
</div>
<div description="Sam">
<div class="ig"><a href="#"><img src="#"></a></div>
<div>Sam</div>
</div>
</div>
And there is a search text field with the id "find". The task is to ensure that when you enter in this field, only will remain whose part matches the entered one. I made this script:
<script type="text/javascript">
$('#find').change(function(){
var filter = $(this).val();
if (filter) {
$matches = $('#data').find(':Contains(' + $('#find')[0].value + ')');
$('div[description]','#data').not($matches).hide();
$matches.slideDown();
} else {
$('#data').find('div').show();
} return false;
})
.keyup( function () {
$(this).change();
});
</script>
It works but is case sensitive. I just can’t make the search case-insensitive. How can I change the code? Or maybe use some other method?