Jquery, how to know when input have a :invalid selector?

前端 未结 1 765
闹比i
闹比i 2021-01-01 21:37

I have this code:

HTML


         


        
相关标签:
1条回答
  • 2021-01-01 21:42

    Use the is function to test for the :invalid pseudoclass:

    if ($(this).is(":invalid")) {
        showMessage("Invalid value");
    }
    

    Example: http://jsbin.com/ikuwur/2/edit

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