Check if multiple elements with same class exist
jquery
Solution
Try to use the `length` property to accomplish your task,
if($('.panel').length > 1) {
console.log('yes, more than one element exist')
}
Problem
Wonder if there's any way to check if elements with the same class exists in a document. For example: ``` <div class="panel">panel 1</div> <div class="panel">panel 2</div> <div class="panel">panel 3</div> ``` JS: ``` if ( $('.panel')[0] ) { console.log('exists') } ``` .. but I want to check if MORE THAN ONE `panel` element exists, alteast 2.