Skip to content

Instantly share code, notes, and snippets.

View webdevbyjoss's full-sized avatar

Joe Chereshnovsky webdevbyjoss

View GitHub Profile
@webdevbyjoss
webdevbyjoss / gist:4045634
Created November 9, 2012 13:19
Render error messages of Backbone.Validation for Twitter Bootstrap
// Original CoffeScript gist can be found here: https://gist.github.com/2909552 (credits to the author)
// I just translated it to JavaScript for my own needs using Coffeescript to Javascript translator
_.extend(Backbone.Validation.callbacks, {
valid: function(view, attr, selector) {
var control, group;
control = view.$('[' + selector + '=' + attr + ']');
group = control.parents(".control-group");
group.removeClass("error");
if (control.data("error-style") === "tooltip") {