jQuery select change show/hide div event

前端 未结 9 1491
失恋的感觉
失恋的感觉 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:12

    Try this:

    $(function() {
        $("#type").change(function() {
            if ($(this).val() === 'parcel') $("#row_dim").show();
            else $("#row_dim").hide();
        }
    }
    

提交回复
热议问题