You needhave wrong syntax of on as you are not telling what event you want to bind. After binding your required event e.g. click you can use eachmap function to get all the comma separated ids of elements having class star.
$('.star'document).eachon('click', '.star', function(e){ e.stopPropagation();
ids = $('.star').map(function() {
var rating = $( return this).attr('id');id;
}).get().join();
alert(ratingids);
});
or you canYou need to use map functioneach to getiterate through all the comma separated idselements.
ids = $('.star').mapeach(function(){
returnvar rating = $(this).id;attr('id');
}).getalert(rating).join(;
});
You need to use each
$('.star').each(function(){
var rating = $(this).attr('id');
alert(rating);
});
or you can use map function to get all the comma separated ids.
ids = $('.star').map(function(){
return this.id;
}).get().join();
You have wrong syntax of on as you are not telling what event you want to bind. After binding your required event e.g. click you can use map function to get all the comma separated ids of elements having class star.
$(document).on('click', '.star', function(e){ e.stopPropagation();
ids = $('.star').map(function() {
return this.id;
}).get().join();
alert(ids);
});
You need to use each to iterate through all elements.
$('.star').each(function(){
var rating = $(this).attr('id'); alert(rating);
});
You need to use each
$('.star').each(function(){
var rating = $(this).attr('id');
alert(rating);
});
or you can use map function to get all the comma separated ids.
ids = $('.star').map(function(){
var rating =return $(this).attr('id');id; alert(rating);
}).get().join();
You need to use each
$('.star').each(function(){
var rating = $(this).attr('id');
alert(rating);
});
or you can use map function to get all the comma separated ids.
ids = $('.star').map(function(){
var rating = $(this).attr('id'); alert(rating);
}).get().join();
You need to use each
$('.star').each(function(){
var rating = $(this).attr('id');
alert(rating);
});
or you can use map function to get all the comma separated ids.
ids = $('.star').map(function(){
return this.id;
}).get().join();
You need to use each
$('.star').each(function(){
var rating = $(this).attr('id');
alert(rating);
});
or you can use map function to get all the comma separated ids.
ids = $('.star').map(function(){
var rating = $(this).attr('id');
alert(rating);
}).get().join();