Saved Bookmarks
| 1. |
How To Use Length Function In Jquery To Text Existance Of An Element By Id? |
|
Answer» To test if an ELEMENT EXISTS we can use length method in jQuery as below: if $(''#mySampleDiv'').length )//TESTS wheter the div with ID mySampleDiv exists or not $(mySampleDiv).find(''div''); To test if an element exists we can use length method in jQuery as below: if $(''#mySampleDiv'').length )//Tests wheter the div with id mySampleDiv exists or not $(mySampleDiv).find(''div''); |
|