Skip to content

Instantly share code, notes, and snippets.

Created November 2, 2010 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/660170 to your computer and use it in GitHub Desktop.
Save anonymous/660170 to your computer and use it in GitHub Desktop.
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();
});
};
//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