Created
November 3, 2010 17:44
-
-
Save anonymous/661414 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
//SourceSubmissionForm: creates a form used for source submission | |
var SourceSubmissionForm = function() { | |
var _thisInstance = this; | |
//instance members | |
this.index = -1; | |
this.element = null; | |
this.value = ""; | |
//add this instance to list | |
SourceSubmissionForm.instances.push(this); | |
//update index | |
this.index = SourceSubmissionForm.instances.length - 1; | |
//create new form | |
this.element = $('<textarea id="sourceForm' + this.index + '"/>'); | |
this.element.css({'width' : '200px', 'height' : '200px'}); | |
this.element.appendTo("#mid1"); | |
//register change event | |
this.element.change(function() { | |
console.log("outputting this instance fields"); | |
for (var key in _thisInstance) { | |
console.log(key); | |
} | |
_thisInstance.onTextChange(); | |
}); | |
}; | |
//static members | |
SourceSubmissionForm.instances = []; | |
//proto methods | |
SourceSubmissionForm.prototype.onTextChange = function() { | |
console.log("inner update"); | |
this.value = $(this.element).val(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment