0

Following is my javascript/ jquery which runs independently when i save it in text file as html but i am not able to make it work in my VF page. I am getting the following error when i hit F12

Error is

Mixed Content: The page at 'https://zebra--dev2--c.cs15.visual.force.com/apex/ZEB_RMA_AddProduct?caseId=500e0000007zYko&rmaSelId=a2De0000000dEpDEAU&core.apexpages.devmode.url=1' was loaded over HTTPS, but requested an insecure script 'http://code.jquery.com/jquery.min.js'. This request has been blocked; the content must be served over HTTPS. ZEB_RMA_AddProduct:149 Uncaught ReferenceError: $ is not defined

My code is :

<div>
        <label><input type="radio" name="colorRadio" value="Agree"> Agree</input></label>
        <label><input type="radio" name="colorRadio" value="green"> green</input></label>

    </div>
    <div class="red box">You have selected <strong>red radio button</strong> so i am here</div>
    <div class="green box">You have selected <strong>green radio button</strong> so i am here</div>

    <style type="text/css">
    .box{
        padding: 20px;
        display: none;
        margin-top: 20px;
        border: 1px solid #000;
    }
    .red{ background: #ff0000; }
    .green{ background: #00ff00; }
    .blue{ background: #0000ff; }
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('input[type="radio"]').click(function(){
        if($(this).attr("value")=="red"){
            $(".box").not(".red").hide();
            $(".red").show();
        }
        if($(this).attr("value")=="green"){
            $(".box").not(".green").hide();
            $(".green").show();
        }

    });
});
</script>

Thanks in advane for your help

1

Try using following URL in script tag. https://code.jquery.com/jquery.min.js instead http://code.jquery.com/jquery.min.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.