Hide or Display div via a RadioButton via Jquery

1

Follow the code below:

HTML:

<asp:RadioButtonList ClientIDMode="Static" ID="rbAtivoInativo" runat="server" RepeatDirection="Horizontal" AutoPostBack="true"> <%--OnSelectedIndexChanged="rbAtivoInativo_SelectedIndexChanged"--%>
     <asp:ListItem Value="ATIVO" Selected="True">Sim</asp:ListItem>
     <asp:ListItem Value="INATIVO">Não</asp:ListItem>
</asp:RadioButtonList>

I wanted to see a div that is hidden when the RadioButton with the INACTIVE value was selected.

    
asked by anonymous 18.07.2014 / 14:35

2 answers

0

Thank you very much for the answer, but I have already been able to solve it. Follow the code if anyone ever needs it.

 $("#rbAtivoInativo input").click(function () {
    var select = $(this).val();
    if (select == "INATIVO") {
        $("#cphConteudo_divMotivoInativacao").show();
    } else {
        $('#cphConteudo_divMotivoInativacao').hide();
    }
});
    
21.07.2014 / 21:08
0

Via jQuery?

Solution

Firstly import jQuery, placing it in the head of the file. Next, create a div and set it initially as display: none; in the style sheet. After, add the interactivity (within a <script> ): when it is clicked such , visible. If tal2 , invisible. Example:

$('input#ativo').change(function(){
    $('div#alvo').fadeIn();
});

$('input#inativo').change(function(){
    $('div#alvo').fadeOut();
});

fadeIn and fadeOut can be easily replaced by show and hide .

I've created a JSFiddle

Sorry if the request was not made. I do not know the asp , however rather PHP and jQuery .     

18.07.2014 / 16:22