I'm relatively new with JQuery. Let's say I have a divs structure like this:
<div class='quater'>
<div id='a' class='target'></div>
<div id='b' class='target'></div>
<div id='c' class='no_target'></div>
</div>
and i would like to ad an onClick function that retrieve class "target" id's.
I tried with:
$('.quater').on('click', function(){
var $value = $(this).children('.target');
$value.each(function(){
alert(this.attr('id'));
});
});
but it returns: undefined is not a function
What is the right way to iterate through these elements to retrieve their ids?