Skip to content

Instantly share code, notes, and snippets.

Created November 2, 2010 20:05
Show Gist options
  • Save anonymous/660203 to your computer and use it in GitHub Desktop.
Save anonymous/660203 to your computer and use it in GitHub Desktop.
//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() {
_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