jQuery check if <input> exists and has a value

后端 未结 7 798
情歌与酒
情歌与酒 2021-02-01 00:07

I have the following example:


Is there a way to check if this element exists and ha

7条回答
  •  遥遥无期
    2021-02-01 01:10

    The input won't have a value if it doesn't exist. Try this...

    if($('.input1').val())
    

提交回复
热议问题