Show and hide html element on selected option change

前端 未结 10 1604
耶瑟儿~
耶瑟儿~ 2021-01-12 04:31

In a JSP page, I have a dropdown list. When the first element of the list is selected, I want a text area to show right on click. I\'m new to Javascript/Jquery, so I\'m obvi

10条回答
  •  花落未央
    2021-01-12 04:52

    You can do also using jQuery as follows.

    $("#show").change(function(){
       if($(this).val()=="1")
       {    
           $("#text_area").show();
       }
       else
       {
           $("#text_area").hide();
       }
    });
    

    Demo

提交回复
热议问题