Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to remove case sensitivity from email in js

I want to remove the case sensitivity from emails when searching emails.
For further explanation, If I search an email(dmc@gmail.com) in a different ways like this 'DMC@gmail.com' or 'dMc@gmail.com' or 'Dmc@gmail.com'. I want to retrieve the email. If anyone can help, really appreciated.

Thank you

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

In order to achieve that you could get the text value from the search input and transform it to lowercase before executing the search, you can do that in JS with the method [yourText].toLowerCase()

Example:

<!DOCTYPE html>
<html>
<body>

<h1>JavaScript String to lowercase</h1>

<input id="your-input" type="text">

<button onclick="convertText()">To lowercase!</button>

<p id="demo"></p>

<script>
function convertText() {
let text = document.getElementById("your-input").value;
document.getElementById("demo").innerHTML = text.toLowerCase();    
}

</script>

</body>
</html>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading