0

I updated jQuery 1.8.3 to latest version and jQuery validation engine stopped working. I tested it with 1.8.3+ (any version) but it doesn't work.

JS:

$(document).ready(function() {
    $("#source").select2({
        closeOnSelect: false,
        formatResult: format,
        formatSelection: format,
        blurOnChange: true
    });
    $('#testform').validationEngine({ prettySelect: true, usePrefix: 's2id_', autoPositionUpdate: true });
});


function format(state) {
    // Update: Made it work by changing "state.element" to $(state.element). 
    var originalOption = $(state.element);
    return originalOption.data('foo') + " " + state.text;
}

How do I fix this ?

Demo in JSfiddle (changed to jQuery 1.8.3) validation worked.

Kamran Ahmed
  • 7,661
  • 4
  • 30
  • 55
user27133
  • 487
  • 4
  • 16
  • 31
  • 1
    Replace instances of `.live(` with `.on(`. You should learn how to debug js errors: http://stackoverflow.com/questions/988363/how-can-i-debug-my-javascript-code – Joe Jul 25 '14 at 09:24
  • you can either try to update the validate engine version, or use the jQuery migration plugin – Arun P Johny Jul 25 '14 at 09:25

1 Answers1

1

The problem is the usage of .live() method in validate engine 2.6 which was removed in jQuery 1.9.

You can update the validate engine to 2.6.2 or latest where it is fixed by using .on()

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531