0

I need to assign another instance of jQuery o jquery-validate plugin. I need to call pjQ.jQuery instead of jQuery. One example of the files i need to change:

(function( factory ) {
    if ( typeof define === "function" && define.amd ) {
        define( ["jquery", "../jquery.validate"], factory );
    } else if (typeof module === "object" && module.exports) {
        module.exports = factory( require( "jquery" ) );
    } else {
        factory( jQuery );
    }
}(function( $ ) {

/*
 * Translated default messages for the jQuery validation plugin.
 * Locale: Az (Azeri; azərbaycan dili)
 */
$.extend( $.validator.messages, {
    required: "Bu xana mütləq doldurulmalıdır.",
    remote: "Zəhmət olmasa, düzgün məna daxil edin.",
    email: "Zəhmət olmasa, düzgün elektron poçt daxil edin.",
    url: "Zəhmət olmasa, düzgün URL daxil edin.",
    date: "Zəhmət olmasa, düzgün tarix daxil edin.",
    dateISO: "Zəhmət olmasa, düzgün ISO formatlı tarix daxil edin.",
    number: "Zəhmət olmasa, düzgün rəqəm daxil edin.",
    digits: "Zəhmət olmasa, yalnız rəqəm daxil edin.",
    creditcard: "Zəhmət olmasa, düzgün kredit kart nömrəsini daxil edin.",
    equalTo: "Zəhmət olmasa, eyni mənanı bir daha daxil edin.",
    extension: "Zəhmət olmasa, düzgün genişlənməyə malik faylı seçin.",
    maxlength: $.validator.format( "Zəhmət olmasa, {0} simvoldan çox olmayaraq daxil edin." ),
    minlength: $.validator.format( "Zəhmət olmasa, {0} simvoldan az olmayaraq daxil edin." ),
    rangelength: $.validator.format( "Zəhmət olmasa, {0} - {1} aralığında uzunluğa malik simvol daxil edin." ),
    range: $.validator.format( "Zəhmət olmasa, {0} - {1} aralığında rəqəm daxil edin." ),
    max: $.validator.format( "Zəhmət olmasa, {0} və ondan kiçik rəqəm daxil edin." ),
    min: $.validator.format( "Zəhmət olmasa, {0} və ondan böyük rəqəm daxil edin" )
} );
return $;
}));

Would be enough to call pjQ.jquery in the end like below?

})(pjQ.Jquery));

or do i simply need to replace factory( jQuery ); with factory( pjQ.jQuery );

In lower versions of jqueryvalidation plugin like 1.10.0 i would simply replace jQuery.validator with pjQ.jquery.validator

Thanks in advance

João Costa
  • 487
  • 2
  • 6
  • 19
  • One question: why? Please explain the idea behind why you think you'd need to do this? – Sparky Nov 05 '17 at 18:01
  • It's because i'm using a script from PHPjabbers and they use pjQ.jQuery.validator() instead of jQuery.validator(). But i wanted to update jquery validate plugin version from 1.10.0 to 1.17.0. – João Costa Nov 05 '17 at 19:24
  • Still don't understand why there would be two versions of jQuery in use. Regardless, why can't you just update the PHP script so that it uses the same jQuery instance as everything else? – Sparky Nov 05 '17 at 19:46
  • I wish i could answer your question but to understand the reason why phpjabbers framework has this instance created, i would need to review the framework. – João Costa Nov 05 '17 at 19:52
  • You never mentioned a "framework", let alone `PHPJabbers` as such a thing in your OP, so of course, some people are going to have no idea what is going on here. I would also seriously question this "framework" as to why their jQuery Validate version is ridiculously out of date... released 9/7/2012 – Sparky Nov 05 '17 at 21:42
  • Have you looked at the jQuery documentation yet? `.noConflict()` will allow you to use more than one jQuery version. https://api.jquery.com/jquery.noconflict/ – Sparky Nov 05 '17 at 21:44
  • I've replaced factory( jQuery ) with factory( pjQ.jQuery ); and it's working fine with plugins updated. – João Costa Nov 05 '17 at 23:22

0 Answers0