Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi Guys,

I have one dropdown (id - ddlnoofchild) and one radio button list in my asp.net form.
I want a javaScript function, which will make the radio button list mandatory if user selects any item from the dropdown.

What is the script for that ?
Posted
v2
Comments
Vani Kulkarni 12-Jul-12 7:39am    
Do you want to inform users that RadioButtonList is to be selected if they select a dropdown or you want that to happen programmatically?

 
Share this answer
 
XML
<script type="text/javascript" >
        function myFunc()
        {

         var selectedDdl = $("option:selected", "#ddlnoofchild").text();
           if (selectedDdl == "ddltext")
            {
                $(":radio").each(function ()
                {
                    $(this).removeAttr("disabled");
                });

            }


        }
    </script>

Put your value in place of ddltext
 
Share this answer
 
v2
Comments
shinebudy 13-Jul-12 1:56am    
hey budy i wanted at time of drodown selection
means if i select my ddlnoofchild user compulsory select radiobuttonlist if user not click
on radiobutton list so at time i want alert msa plz select radiobutton list how can i do?
hey shinebudy try this:
HTML
checkedvar=$('input[name=RadioButtonList1]:checked').val();

put your radio button id in place of "RadioButtonList1"
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900