jquery - how to show multiple alerts in html web page using javascript -
i have web page in there check button if 1 button selected shows 1 alert , if 2 should show 2 alerts shows alert 1 of button selected first .
i using following code
$(document).ready(function(){ $("#email_multiple").click(function(){ var n = $("input:checked").length; //alert(n); //for(var i=1;i<=$("input:checked").length;i++){alert(n);} if(!($("input:checked").length)){ alert('please make check on check box field hahahahha...'); return false; } if(n==1){ var bb = $("input:checked").val(); alert(bb); presenter.command("emailsend",{ "toemail": "", "toname": "", "subject": "", "body": "single attachment", "bodyhtml":"", "attachments": ["/images/animal/pdf/"+bb+".pdf"] }); $('input[type=checkbox]').attr('checked',false); } if(n==2){ var bb = $("input:checked").val(); alert(bb); presenter.command("emailsend",{ "toemail": "", "toname": "", "subject": "", "body": "single attachment", "bodyhtml":"", "attachments": ["/images/animal/pdf/"+bb+".pdf","/images/animal/pdf/"+bb+".pdf"] }); $('input[type=checkbox]').attr('checked',false); } }); });
$(document).ready(function(){ $("#email_multiple").click(function(){ var n = $("input:checked").length; if(!($("input:checked").length)){ alert('please make check on check box field hahahahha...'); return false; } for(var i=0; < n; i++){ var bb = $($("input:checked")[i]).val(); alert(bb); } }); });
Comments
Post a Comment