How can I determine if a variable is 'undefined' or 'null'?

前端 未结 30 1513
耶瑟儿~
耶瑟儿~ 2020-11-22 03:30

How do I determine if variable is undefined or null?

My code is as follows:

var EmpN         


        
30条回答
  •  死守一世寂寞
    2020-11-22 03:52

    jQuery check element not null:

    var dvElement = $('#dvElement');
    
    if (dvElement.length  > 0) {
        // Do something
    }
    else{
        // Else do something else
    }
    

提交回复
热议问题