I want to add toggle attribute to mysite. When I click hide/show button, it should show/hide divs. According to alphabetical order, a user who click a letter will show the content which starts with that letter. So my code is here :
<script>
$(document).ready(function() {
$('#button_letter_A').click(function() {
$('#portfolio_item_A').toggle();
});
$('#button_letter_B').click(function() {
$('#portfolio_item_B').toggle();
});
});
</script>
Instead of writing all letters in an order; how to write this code in a quick way. For example; can I make it with for loops in javascript?
Reference: