Check that element is in DOM or not with jQuery?

前端 未结 3 420
野性不改
野性不改 2020-12-21 05:22

I have quick and simple question. How can I check that an element is in the DOM or not?

For example how can I check if there is

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 05:57

    if ( $("#does_i_really_exist_or").length ) {
       //-- It does exist.
    }
    

提交回复
热议问题