I am not a programer but I enjoy building prototypes. All of my experience comes from actionScript2.
Here is my question. To simplify my code I would like to figure
One solution you could use is to assign a more generalized class to any div you want the click event handler bound to.
For example:
HTML:
dog
cat
mouse
JS:
$( ".selected" ).each(function(index) {
$(this).on("click", function(){
// For the boolean value
var boolKey = $(this).data('selected');
// For the mammal value
var mammalKey = $(this).attr('id');
});
});