Home > Net >  select the option show the button use jquery
select the option show the button use jquery

Time:01-25

$(function () {
   
    $('#<%=btnclick1.ClientID%>').click(function () {
        $("#select option[value=F]").attr('selected', 'selected');
        $("#popupdiv1").dialog({
           
            title: "ORANGE",
            width: 430,
            height: 250,
            modal: true,
            buttons: {
                close: function ()
                {

                    $(this).dialog('close');
                }
            }
        });

        return false;
    });

I want to change opposite function, ex: if I select the dropdown specific value show the specific button how it is possible please any one know in jQuery

CodePudding user response:

$(document).ready(function(){
    $("#dropdown").change(function(){
        var selectedValue = $(this).val();
        if(selectedValue == "specific value1"){
            $("#button1").show();
        } else if(selectedValue == "specific value2"){
            $("#button2").show();
        }else{
            $("#button1,#button2").hide();
        }
    });
});
  • Related