Just starting to explore jQuery and still fresh on JS knowledge, I have the desire to craft a jQuery script.
To begin with, here is my HTML snippet:
<div id="user-controls">
<div class="choice" id="choice-all" onclick="showAll();">All</div>
<div class="choice" id="choice-asus" onclick="justASUS();">ASUS</div>
<div class="choice" id="choice-htc" onclick="justHTC();">HTC</div>
</div>
<div id="devices">
<div class="android asus">Nexus 7</div>
<div class="android htc">One S</div>
<div class="android htc">One X+</div>
<div class="android asus">Transformer Prime</div>
<div class="winph htc">Windows Phone 8X</div>
</div>
An ideal jQuery code would be able to carry out the following actions:
Clicking on the #choice-asus DIV should hide all DIVs with the .htc class
Clicking on the #choice-htc DIV should hide all DIVs with the .asus class
Clicking on the #choice-all DIV should set all DIVs to display="inline-block" (the default setting upon page load)
I've made an attempt with the code below, but unfortunately, it's not yielding any results.
$(document).ready(function(){
$("#choice-htc").click(function(){
$(".htc").hide();
})
});
Your assistance will be greatly appreciated. Best regards, Dylan.