Skip to content

Instantly share code, notes, and snippets.

@rodrigo-x
Created October 15, 2012 00:12
Show Gist options
  • Save rodrigo-x/3890240 to your computer and use it in GitHub Desktop.
Save rodrigo-x/3890240 to your computer and use it in GitHub Desktop.
snippet - colocar * no input...
$(function(){
$.input = function(elem){
$(elem)
.val("*")
.keyup(function(){
self = $(this);
inputValue = self.val();
charPos = inputValue.indexOf("*");
if(charPos > 0){
charIn = inputValue.slice(charPos);
self.val(charIn);
}
if(charPos === -1){
self.val("*" + inputValue);
}
});
}
$.input("#input02");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment