jQuery: Checking if next element exists

后端 未结 7 780
庸人自扰
庸人自扰 2020-12-02 18:08

Is there a way to check if an next element exists? Check my code:

if($(\"#people .making-of .mask ul li.current\").next(\"li\") != null) {
    alert(\"Exists         


        
相关标签:
7条回答
  • 2020-12-02 19:05

    I think this is good to use like.

       if ($(this).nextAll().length > 0) { 
    
         alert("Exists");
    
       }else{
    
         alert("Don't exists");
    
       }
    
    0 讨论(0)
提交回复
热议问题