javascript - How to check an id in a webpage is there or not using jquery -


can tell me how know if id tag in webpage present or not. suggest using jquery.

use length property of jquery object. amount of elements found selector. there no need use > 0 too, because 0 interpreted false.

if( $("#myid").length ) {     // available } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -