How to do JavaScript object introspection?

前端 未结 3 1952
春和景丽
春和景丽 2020-12-14 10:51

What to do when after all probing, a reportedly valid object return \'undefined\' for any attribute probed? I use jQuery, $(\'selector\').mouseover(function() { });

3条回答
  •  再見小時候
    2020-12-14 11:29

    Is selector the name of the element? If so then you should reference it as:

    $('area#selector')
    

    or

    $('#selector')
    

    otherwise it will attempt to look for the (non-existent) "selector" HTML tag and, obviously, not find it.

提交回复
热议问题