How to check 'undefined' value in jQuery

后端 未结 11 571
慢半拍i
慢半拍i 2020-12-12 11:49

Possible Duplicate:
Detecting an undefined object property in JavaScript
javascript undefined compare

H

11条回答
  •  攒了一身酷
    2020-12-12 12:24

    I know I am late to answer the function but jquery have a in build function to do this

    if(jQuery.type(val) === "undefined"){
        //Some code goes here
    }
    

    Refer jquery API document of jquery.type https://api.jquery.com/jQuery.type/ for the same.

提交回复
热议问题