Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@collin
Created July 30, 2008 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save collin/3223 to your computer and use it in GitHub Desktop.
Save collin/3223 to your computer and use it in GitHub Desktop.
$.password
:blur
if @value === ""
.hide()
var faux = $this.prev()
faux.show().val(faux.attr('default_value'))
.blur()
$.faux-password
:focus
.hide().next().show().focus()
The icky feelings that represent javascript start to rear their ugly heads around lines 5-6
A number of times I've had this problem of needing to set a variable referencing another element.
instead of:
var faux = $this.prev()
faux.show().val(faux.attr('default_value'))
What about something like:
.prev() becomes faux
faux.show().val(faux.attr('default_value'))
or even
with .prev()
.show().val(@default_value)
OR is there already something do deal with/wholly circumvent this issue?
(I think you guys have $this as _jabl_context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment