robert_gsfame Posted April 13, 2010 Share Posted April 13, 2010 I have dynamic checkboxes, so that number of checkboxes appeared depends on users then how can i get the value from checked checkbox let say i have this $id is the data that i retrieve from database <input type="checkboxes" value=<?php echo $id;?>><a href=javascript:void(0) onclick="getvalue()"> thx Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 13, 2010 Share Posted April 13, 2010 Loop through them. Check if it's checked, and if so, get the value. Example code: var i = document.getElementById("input"), ic = i.length; for (var a = 0; a < ic; a++) if (i[a].type == "checkboxes" && i[a].checked) window.alert(i[a].value); Quote Link to comment Share on other sites More sharing options...
robert_gsfame Posted April 14, 2010 Author Share Posted April 14, 2010 The problem is that if there is more than 1 checked checkbox, then how can i get both values Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.