I created a page and want to display some data when the user types and search for a specific name of Region.
I set the function below inside a for loop function and it works, i.e: whenever the user types the name of a region listed into a JSON file I'm connecting to, some data are appended to the tbody
:
if (region === textRegione) {
$("#tbody").append("<tr><td>" + tappa.name + "</td><td>" + tappa.state + "</td><td>" + tappa.region + "</td><td>" + tappa.city + "</td></tr>"
);
$("#tabella").show();
}
The problem is that the user has to write the name of the Region wit the first letter in uppercase and the rest of the word in lowercase. I want to use the functions toUpperCase()
and toLowerCase()
in order to tell the browser to display the info no matter which is the case of the letters. I wrote the following ut it doesn't work:
if (region === textRegione && textRegione.toLowerCase() && textRegione.toUpperCase()) {
$("#tbody").append("<tr><td>" + tappa.name + "</td><td>" + tappa.state + "</td><td>" + tappa.region + "</td><td>" + tappa.city + "</td></tr>"
);
$("#tabella").show();
}
;
The info are still shown but only if the word is typed with first letter in uppercase and the rest in lowercase...
Aucun commentaire:
Enregistrer un commentaire