Can I apply the required attribute to <select> fields in HTML5?

前端 未结 13 2382
不知归路
不知归路 2020-11-22 16:20

How can I check if a user has selected something from a doesn\'t support the new

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 16:52

    You can do it also dynamically with JQuery

    Set required

    $("#select1").attr('required', 'required');
    

    Remove required

    $("#select1").removeAttr('required');
    

提交回复
热议问题