jQuery select change show/hide div event

前端 未结 9 1472
失恋的感觉
失恋的感觉 2020-11-27 17:34

I am trying to create a form which when the select element \'parcel\' is selected it will show a div but when it is not selected I would like to hide the div. Here is my mar

9条回答
  •  时光取名叫无心
    2020-11-27 18:19

    change your jquery method to

    $(function () { /* DOM ready */
        $("#type").change(function () {
            alert('The option with value ' + $(this).val());
            //hide the element you want to hide here with
            //("id").attr("display","block"); // to show
            //("id").attr("display","none"); // to hide
        });
    });
    

提交回复
热议问题