Created
August 1, 2010 13:15
-
-
Save sinefunc/503344 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a mixin that will be applied to a `fieldset.row`. | |
// `this` in these functions will refer to a $("fieldset.row"). | |
// Put your long complicated functions here | |
var Row = { | |
$name: function() { | |
return this.find('input[name=name]'); | |
}, | |
changeName: function(value) { | |
this.$name().val(value); | |
}, | |
disable: function() { | |
this.find('select, input').attr('disabled', 1); | |
this.find('span').html("(disabled)"); | |
} | |
}; | |
// Now they can be accessed like so... | |
$row = $("fieldset.row").extend(Row); | |
$row.changeName("Jason"); | |
$row.disable(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment