Jump to content

I need help with my script code


tapukatata

Recommended Posts

Hi,

I have a script written but that script disable "add to cart" button when I select any attribute (not default one) 

I have installed the script on my demo here: http://iskambg.com/iskampanda4/bg/stoki-za-doma-bita/688-399-mreja-za-vrata-s-magnit.html

I hope that anyone could help me to resolve the problem

 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
    //$('#occ-city [name="city"]').attr("keyup","kufun(this)");


    /*$(document).click(function (e) {
        console.log($(e.target).attr("display"));
        /!*if (!$(e.target).hasClass("btn") && $(e.target).parents(".dropdown").length === 0)
        {
            $(".dropdown").hide();
        }*!/
    });*/


    function customadd(){
        var aa = Math.floor(Math.random() * 20);
        $("#office_id").val(aa);
        $("#occ-postcode input").val('0000');
    }

    $("#occ-city #occ-city-select li").onmouseover(function(){
        console.log('hover');
        $("#occ-city #occ-city-select li").css("background-color",'#ffffff')
    });

    function customlist(){
        var cval = $("#occ-city input[name=city]").val();
        if(cval != ''){
            $("#occ-office-name input[name=office_name]").keyup();
            $("occ-office-select").css("display",'block');
        }
    }

    $.fn.clickOff = function(callback, selfDestroy) {
        var clicked = false;
        var parent = this;
        var destroy = selfDestroy || true;

        parent.click(function() {
            clicked = true;
        });

        $(document).click(function(event) {
            if (!clicked) {
                callback(parent, event);
            }
            if (destroy) {
                //parent.clickOff = function() ;
                //parent.off("click");
                //$(document).off("click");
                //parent.off("clickOff");
            };
            clicked = false;
        });
    };
    $("#occ-city").clickOff(function() {
        var gdisp = $("#occ-city-select").css("display");
        if(gdisp == 'block'){
            $("#occ-city-select").css("display","none");
        }
    });

    $("#occ-office-name").clickOff(function() {
        var gdisp = $("#occ-office-select").css("display");
        if(gdisp == 'block'){
            $("#occ-office-select").css("display","none");
        }
    });

    $("#occ-street").clickOff(function() {
        var gdisp = $("#occ-street-select").css("display");
        if(gdisp == 'block'){
            $("#occ-street-select").css("display","none");
        }
    });

    $("#occ-quarter").clickOff(function() {
        var gdisp = $("#occ-quarter-select").css("display");
        if(gdisp == 'block'){
            $("#occ-quarter-select").css("display","none");
        }
    });
    /*function kufun(e) {
        var sresult = e.value.length;
        console.log(sresult);
        vlsz = '';
        if(parseInt(sresult) >= 2){
            var vlsz = e.value;
            var Shtml = '<li><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">waqas</font></font></li>';
            $("#occ-street .occ-search-list").append(Shtml);
        }
    }*/

</script>

 

Edited by diyan1234 (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...