Check whether an Element Exists using JQuery
In JavaScript to check whether an element exist or not we can use something like this
1 2 3 | if(document.getElementById( 'Elementid' )) |
But in case of jQuery to check an element exist or not the code can be written like this
1 2 3 | if ( $( '#elementId' ).length >0 ) |
We can also…