I am in a dilemma and I need help with Javascript. I need to create code that whenever a user enters a word like CHickEN it needs to match chicken. More examples: “CHICKEN”,"ChIcKeN”, “cHICKen” needs to match chicken. How can I achieve this?
document.getElementById('searchBox').addEventListener('keydown', function (event) {
if (event.which === 13 || event.keyCode === 13) {
var searchText = this.value;
var list = document.querySelectorAll('dd, h1, h2, span, dt');
var list2 = document.querySelectorAll('dd');
var items = document.querySelectorAll('li');
for(var i = 0; i < list.length; i++){
list[i].style.backgroundColor = '';
list[i].style.diplay = 'none';
if (list[i].textContent == searchText){
list[i].style.backgroundColor = 'yellow';
list[i].ignoreCase;
}
}
}
});