Hello,
First StackOverflow question - woo!
Quick question about styling this piece of Javascript:
//Search
$('#search').keydown(function(e) {
setTimeout(function() {
if ($('#search').val() == '') {
$('#history h4').show();
$('#history li li').show();
return;
}
$('#history h4').hide();
var search = $('#search').val().toLowerCase();
$('#history li li').each(function() {
var thisId = $(this).attr('id').substr(13);
var item = $.grep(history, function(item) { return item.id == thisId; })[0];
if (item.message.toLowerCase().indexOf(search) != -1 || item.link.toLowerCase().indexOf(search) != -1)
$(this).show();
else
$(this).hide();
});
}, 1);
});
});
Where do I put the CSS styling in the javascript to highlight the letters in the search results?
<font class="highlight"></font>
This is similar to searching using Ctrl+F in the browser.
Any help would be greatly appreciate. Thanks!
JP