Search code examples
javascriptjquerylightboxlightbox2

lightbox2 is conflicting with scripts


I am using LightBox2 for a simple image gallery. I managed to make it work, however now it's conflicting with another javascript script file which I'm referencing from my page.

My script is using $(document).ready(function () {

I'm not sure if it's relevant or not however I know that at one point the browser's debugger was complaining about it.

Any insights on this ?

============================================================ I included part of the code that is generating the error. although this was working fine.

var currs = {};

jQuery.noConflict();

jQuery(document).ready(function () {
    var marketTypeSel = document.getElementById("selMarketType");
    var propertyTypeSel = document.getElementById("selPropertyType");
    var propertyStatusSel = document.getElementById("selPropertyStatus");
    var zoneSel = document.getElementById("selZone");
    var locSel = document.getElementById("selLocalities");
    var currSel = document.getElementById("selCurrency");
    var priceFromSel = document.getElementById("selPriceFrom");
    var priceToSel = document.getElementById("selPriceTo");

    //var data = {};

    marketTypeSel.length = 0;
    propertyTypeSel.length = 0;
    propertyStatusSel.length = 0;
    zoneSel.length = 0;
    locSel.length = 0;
    currSel.length = 0;

    jQuery.ajax({
        type: "POST",
        url: "/Search/LoadInitSearchParameters",
        //data: data,
        dataType: "json",
        success: function (result) {

Solution

  • You can use a jquery no conflict like this below

    var Jk = jQuery.noConflict();
    Jk(document).ready(function (){
    
    
    });