diff options
| author | Quentin Roy <royque@gmail.com> | 2011-11-20 05:56:06 -0800 |
|---|---|---|
| committer | Quentin Roy <royque@gmail.com> | 2011-11-20 05:56:06 -0800 |
| commit | 4d76f0886f18fb089f39c0ca713289f5d47da544 (patch) | |
| tree | af215af3093020011f15ebcb34c5de36a1042b2e /budget/static/ihatemoney/custom.js | |
| parent | 9962b6d60f7c193cbdd34e76f8d2b414a4fc675b (diff) | |
| parent | a5cc50b0c245f55e15e8fc43feed90dbbc6ab771 (diff) | |
| download | ihatemoney-mirror-4d76f0886f18fb089f39c0ca713289f5d47da544.zip ihatemoney-mirror-4d76f0886f18fb089f39c0ca713289f5d47da544.tar.gz ihatemoney-mirror-4d76f0886f18fb089f39c0ca713289f5d47da544.tar.bz2 | |
Merge pull request #68 from Tinmn/master
Addition of an auto hiding user information message...
Diffstat (limited to 'budget/static/ihatemoney/custom.js')
| -rw-r--r-- | budget/static/ihatemoney/custom.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/budget/static/ihatemoney/custom.js b/budget/static/ihatemoney/custom.js index 6a813b9..0bbd542 100644 --- a/budget/static/ihatemoney/custom.js +++ b/budget/static/ihatemoney/custom.js @@ -15,3 +15,30 @@ } } +// Automatically hide and show the default value of a text field +// handly in order to write user information in the text field. +// jquery selector should return only one text field. + var auto_hide_default_text = function(text_field_selector){ + // record the text in the text field before the first text field focus + var default_text; + + var hide_text = function(){ + if(default_text==undefined){ + default_text=this.value; + this.value=""; + } + else if(this.value==default_text){ + this.value=""; + } + } + + var show_text = function(){ + if(this.value==""){ + this.value=default_text; + } + } + + var field = $(text_field_selector); + field.focus(hide_text); + field.blur(show_text); + }
\ No newline at end of file |
