Loading...
Feedback

Improvement in the Masked Input Plugin for jQuery

 

Surely many of you already know this great plugin (Masked Input Plugin from Josh Bush) to facilitate data entry forms by assigning a mask to facilitate the introduction of structured data.

The plugin works really well, but we think it was a major weak point for some types of data, in particular to enter dates. The eternal question of what value (month or day) should be first, depending on the language and the place where you are. To fix this we have slightly modified the plugin to accept a "placeholder" of more than one character and that will be displayed when editing the input until it is completed.

 

With this modification, the plugin accepts values of more than one character in the configuration parameter "placeholder"

    
$ ("#date").mask ("99/99/9999", {placeholder: 'dd/mm/yyyy'});

Here you can see an full example of use.

Original Plugin: http://digitalbush.com/projects/masked-input-plugin/

Modified plugin (source): jquery.maskedinput-1.2.2-co.js

Modified plugin (min): jquery.maskedinput-1.2.2-co.min.js

4 comments

Genial su modificación, pero hay una que se le escapó y que es otra carencia que este gran plugin tiene que es con el ingreso de direcciones de e-mail.
Ricardo Avalos 10.12.2010 | 15:43
Gracias!!

No creo que para los mails sea tan sencillo, ya que los mails no tienen unas longitudes conocidas a priori, de forma que intentar aplicar la misma idea para un e-mail supondría modificar sustancialmente la forma en la que funciona el plugin.

¿Te animas a intentarlo tú Ricardo?
ramiro 10.12.2010 | 15:54
Ramiro,

Me devuelves una pelota que primero te había tirado a ti!!

Esto si que es chasco para mi!! jajajajajajajaja
Ricardo Avalos 10.12.2010 | 16:06
Definitely an improvement, considering all of the different date notation formats used all around the world (http://en.wikipedia.org/wiki/Date_notation_by_country)
UnUsability 16.05.2011 | 22:44
Add a comment




or Preview
 
Conductiva • © 2007-2009 All Rights Reserved  • terms and conditions