I have a textbox with "text-transform: capitalize;" and it works fine, but when I try to get it's value it's not transformed. For example I write in "test" and it shows "Test" in the textbox, but when I do "console.log("document.getElementById("search").value")" it displays "test".
How can I fix this?
Here is my code :
HTML:
<input type="text" id="search"/>
<button type="submit" onclick="query()">Submit</button>
<div class="query-div"><p class="query-p">Test-a</p></div>
<div class="query-div"><p class="query-p">Test-b</p></div>
<div class="query-div"><p class="query-p">Test-ba</p></div>
Javascript:
function query() {
var x = document.querySelectorAll(".query-p");
var y = document.getElementById("search");
var i;
for(i = 0; i < x.length; i++) {
if(x[i].innerHTML.includes(y.value)) {x[i].style.display = 'block';} else {x[i].style.display = 'none';}
console.log(x[i].innerHTML);
}
}