I am completely puzzled by this. Here is my CSS:
$(window).load(function(){ $('.zichtbaar').removeClass('zichtbaar').addClass('verborgen'); $('#zoekitem').focus(); $('.letter').on('click', function(){ $('.zichtbaar').addClass('verborgen').removeClass('zichtbaar'); var letter = $(this).text(); var klasse = "LETTER-" + letter; var el = $('.' + klasse); alert(klasse + " - " + el.length); $('#alfabet-header').html(letter); el.addClass('zichtbaar').removeClass('verborgen'); }); });
#zoekitem{ font-size: 1.3em; } #letter-header{ height: 32px; color: royalblue; font-size: 1.5em; font-weight: bold; overflow: hidden; } .letter{ float: left; width: 3.7037037037037%; cursor: pointer; text-align: center; } #alfabet-header{ font-size: 5em; font-weight: bold; } .inhoud{ margin-left: 10%; } .verborgen{ display:none; } #zoek-header{ font-size: 2em; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <div id="letter-header"> <div class="letter">A</div> <div class="letter">B</div> <div class="letter">βC</div> <div class="letter">ββD</div> <div class="letter">βE</div> <div class="letter">F</div> <div class="letter">βG</div> <div class="letter">βH</div> <div class="letter">ββI</div> <div class="letter">J</div> <div class="letter">ββK</div> <div class="letter">L</div> <div class="letter">βM</div> <div class="letter">βN</div> <div class="letter">O</div> <div class="letter">βP</div> <div class="letter">βQ</div> <div class="letter">βR</div> <div class="letter">βS</div> <div class="letter">T</div> <div class="letter">βU</div> <div class="letter">V</div> <div class="letter">βW</div> <div class="letter">βX</div> <div class="letter">Y</div> <div class="letter">Z</div> <div class="letter">0-9</div> </div> <br/> <div> <div id="alfabet-header"></div> <div id="zoek-header" class="verborgen">Zoekresultaten voor:</div> <div class="inhoud LETTER-A verborgen"><a href="www.appels.com" target="_blank">Appels</a></div> <div class="inhoud LETTER-B verborgen"><a href="www.boerenkool.com" target="_blank">Boerenkool</a></div> <div class="inhoud LETTER-B verborgen"><a href="www.bonen.com" target="_blank">Bonen</a></div> <div class="inhoud LETTER-B verborgen"><a href="www.bosbessen.com" target="_blank">Bosbessen</a></div> <div class="inhoud LETTER-C verborgen"><a href="www.citrus.com" target="_blank">Citrus</a></div> <div class="inhoud LETTER-K verborgen"><a href="www.kappertjes.com" target="_blank">Kappertjes</a></div> <div class="inhoud LETTER-T verborgen"><a href="www.tuinbonen.com" target="_blank">Tuinbonen</a></div> <div class="inhoud LETTER-W verborgen"><a href="www.wittekool.com" target="_blank">Witte kool</a></div> </div>
When I press A, B or T, everything is fine; The warning shows the number of elements that have the class name I'm looking for and displays them. But when I press C, K or W, the elements, although they obviously exist, are not found.
I have not the slightest hint of a clue why this is happening.
source share