Skip to content

Instantly share code, notes, and snippets.

@cjcjameson
Created July 2, 2014 03:12
Show Gist options
  • Save cjcjameson/2562850e989a2d602a74 to your computer and use it in GitHub Desktop.
Save cjcjameson/2562850e989a2d602a74 to your computer and use it in GitHub Desktop.
widget
$(function() {
previewView = new PreviewWidget.View;
previewController = new PreviewWidget.Controller(previewView);
previewController.initializeEventBindings();
});
var PreviewWidget = {
View: function(){
this.updatePreview = function() {
formText = $('#train_name')[0].value
$('.preview_window')[0].innerHTML = formText
};
},
Controller: function(previewView) {
this.initializeEventBindings = function() {
$('#train_name').on('keyup', previewView.updatePreview);
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment