javascript - How do I force lowercase on an input field? -


i have input field client wants lowercase only. output generates input lowercase.

this have , isn't working.

<script> function tolowercase(email) {     strinput.value=strinput.value.tolowercase(); } </script> 

use oninput:

var input = document.getelementsbytagname("input")[0] // input element    input.oninput = function() {    input.value = input.value.tolowercase()  }
<input type="text" />


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -