Skip to content

Instantly share code, notes, and snippets.

@strrife
Last active November 9, 2015 21:11
Show Gist options
  • Save strrife/296ce1ece8703d28454f to your computer and use it in GitHub Desktop.
Save strrife/296ce1ece8703d28454f to your computer and use it in GitHub Desktop.
jQuery dead-simple mvc.
(function bindDeadSimpleMvc($) {
var updateBindings = function () {
console.log($(this).attr('placeholder'));
$('[data-bind="' + $(this).attr('data-bind-variable') + '"]').html($(this).val());
};
$('input[data-bind-variable]').on('change keyup', updateBindings).each(updateBindings);
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment