how to check if input field is empty

前端 未结 7 987
别那么骄傲
别那么骄傲 2020-12-30 01:36

I\'m making a form with inputs, if the input type is empty then the button submit is disabled but, if the input fields is with length > 0 the submit button is enabled

<
相关标签:
7条回答
  • 2020-12-30 02:21

    Try this

    $.trim($("#spa").val()).length > 0
    

    It will not treat any white space if any as a correct value

    0 讨论(0)
提交回复
热议问题