newbie27
asked on
looping through set of checkbox using jquery
Hello Experts,
Can someone of you please let me know is there any error in the attached snippet?
I am trying to loop through the set of check boxes in the page and show all the checked values in an alert. It is over writing the value with the first checkbox selected to the rest.
I am probably doing something wrong here .
Please advice
Regards
s
Can someone of you please let me know is there any error in the attached snippet?
I am trying to loop through the set of check boxes in the page and show all the checked values in an alert. It is over writing the value with the first checkbox selected to the rest.
I am probably doing something wrong here .
Please advice
Regards
s
function addToList(){
if($("#drpLists").val() == 0){
alert('Please select a list');
}else{
var result = "";
$(".chkRefNos").each( function () {
if(this.checked == true){
alert($(".chkRefNos:checked").val());
result = result + $(".chkRefNos:checked").val() + ", ";
}
});
//alert(result);
};
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER