Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Using jQuery to examine a variable's value

Let's say I have a radio select question called Q1. Using jQuery (not JavaScript), how do I examine the value of that variable before the page is advanced? I want this information because I want to display a hidden div based on the selection.
asked Jul 6, 2015 by JKincaid Bronze (995 points)
retagged Jul 6, 2015 by Walter Williams

1 Answer

0 votes
Suppose the name of div hidden is Q2, Please place this code in Q1's footer:

<script type="text/javascript">

function SSI_CustomGraphicalRadiobox(GraphicalRadioboxObj, InputObj)
    {   
        var z=($("input[type=radio]:checked").val());
        //alert(z);
       
        if(z==1)
            {
                    $("#Q2_div").show();
            }
        if(z>1)
            {
                    $("#Q2_div").hide();
                    if($('#Q2').val() != "")
                        {
                                $('#Q2').val("");
                        }
            }
    }

</script>
answered Feb 3, 2016 by KarthikMahankali Bronze (1,445 points)
...