I'm having trouble counting the number of div elements with a specific class. Every time I use .length, it comes back as 0. What could be causing this issue?
var keyspressed
keyspressed = $('.key').length;
console.log(keyspressed)
My document is structured simply like this:
<body>
<div class="keyboard">
<div class="key"> (numerous instances of this element)
Can anyone help me identify where my mistake might be? Thank you!