vendredi 20 mars 2020

Checking for Multiple Conditions in jquery

It checks for multiple conditions no problem. But doesn't go any further then that. When i remove multiple conditions, script works perfectly fine. What is wrong with my code?

    $(document).ready(function () {
        if (window.location.href.indexOf("car-club-insurance") || window.location.href.indexOf("motor-home-hire-insurance") || window.location.href.indexOf("van-minibus-hire-insurance") != -1) {
            $("ol.breadcrumb li:nth-child(1)").addClass("active");
        }
        else if
        (window.location.href.indexOf("FormTwo") != -1) {
            $("ol.breadcrumb li:nth-child(3)").addClass("active");
        }
        else if
        (window.location.href.indexOf("FormThree") != -1) {
            $("ol.breadcrumb li:nth-child(5)").addClass("active");
        }
        else if
        (window.location.href.indexOf("PolicyHolder") != -1) {
            $("ol.breadcrumb li:nth-child(7)").addClass("active");
        }
        else if
        (window.location.href.indexOf("Payment") != -1) {
            $("ol.breadcrumb li:nth-child(9)").addClass("active");
        }         
    });
</script> ```

Aucun commentaire:

Enregistrer un commentaire