Convertir a mayúscula tras abandonar el input
Podría darse el caso de que queremos que los usuarios que se registren en nuestras Web se guarden sus nombres en la base de datos en mayúsculas o minúsculas.
En este artículo vamos mostrar una forma de pasar a mayúsculas los datos introducidos al abandonar el input.
Este efecto lo podemos lograr con el evento onblur de HTML de la siguiente forma:
<input type="text" id="fname" onblur="upperCase()">
En este caso, lo que hace el efecto onblur es llamar a la función upperCase() que tenemos previamente declarada dentro de la etiqueta <head>. La función se encarga de pasar a mayúsculas el contenido depositado en el input.
<script type="text/javascript">
function upperCase() {
var x=document.getElementById("fname").value
document.getElementById("fname").value=x.toUpperCase()
}
</script>
En esta función lo que estamos haciendo es recoger el valor del input con id=»fname» y cambiar su valor a mayúsculas con la función toUpperCase() de javascript.
Autor
Escrito por Jose Aguilar - Director ejecutivo y tecnológico en JA Modules. Experto programador PrestaShop y Experto programador WordPress.
… [Trackback]…
[…] Find More Informations here: jose-aguilar.com/blog/uppercase-onblur/ […]…
I gotta bookmark this web site it seems very useful very helpful
I have learn some just right stuff here. Definitely worth bookmarking for revisiting. I wonder how much attempt you put to make the sort of magnificent informative web site.
Keep up the great piece of work, I read few content on this website and I think that your blog is really interesting and has lots of wonderful information.
Real nice pattern and excellent content , hardly anything else we want : D.
I know this is really boring and you are skipping to the next comment, but I just wanted to throw you a big thanks – you cleared up some things for me!
Regards for helping out, good info .
I simply want to say I am just all new to blogging and actually savored this page. Almost certainly I’m likely to bookmark your website . You really come with perfect articles and reviews. Cheers for revealing your blog.
Some truly superb info , Glad I found this. «No men can be lords of our faith, though they may be helpers of our joy.» by John Owen.
I have not checked in here for a while since I thought it was getting boring, but the last few posts are great quality so I guess I will add you back to my everyday bloglist. You deserve it my friend 🙂
As I website possessor I conceive the written content here is really good , appreciate it for your efforts.
I’ve learn a few just right stuff here. Certainly worth bookmarking for revisiting. I wonder how a lot effort you place to create this type of great informative site.
As I website owner I believe the written content here is real fantastic , thanks for your efforts.
I dugg some of you post as I cogitated they were handy extremely helpful