Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created November 8, 2011 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/1347919 to your computer and use it in GitHub Desktop.
Save walterdavis/1347919 to your computer and use it in GitHub Desktop.
$$('#engrave,#engrave2').invoke('observe','keyup', function(evt){
var limit = 20;
if($F(this).length < limit){
var txt = this.getValue();
var elm;
if(elm = $(this.readAttribute('id') + 'Out')){
elm.down('p').update(txt)
}
}else{
this.setValue($F(this).substr(0,limit));
alert('Too much text!');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment