Passing more parameters from an input element to jquery function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function(){ $(".mychk_box").click(function(){ var loginid = $(this).data('loginid'); var questionid = $(this).data('questionid'); alert('Loginid'+loginid+'Questionid'+questionid); if ($('#mycheckbox').is(":checked")) { alert('Checked'); } }); }); </script> </head> <body> <input type="checkbox" id="mycheckbox" class="mychk_box" data-loginid='545' data-questionid='4343'> <input type="checkbox" id="mycheckbox" class="mychk_box" data-loginid='100' data-questionid='111'> <h2>Passing more than one parameters to a jquery function using checkbox</h2> </body> </html> |