var rbtn_none = 8; // function init() { // handles $('#btn_start').on('click', function() { check_valid(); }); $('.chb_industry').on('click', function() { var this_val = $(this).val(); if (this_val == rbtn_none) { $('.chb_industry[value!=' + rbtn_none + ']').prop('checked', false); } else { $('.chb_industry[value=' + rbtn_none + ']').prop('checked', false); } }); } // function check_valid() { var bol_mother_type = ($("[name=rbtn_mother_type]:checked").val() != undefined); var bol_industry = $(".chb_industry:checked").length > 0; if (bol_mother_type && bol_industry) { survey_start(); } else { alert('請先回答問題'); } } function survey_start() { var industry_list = $(".chb_industry:checked").map(function(){ return $(this).val(); }).get(); // var sURL = submit_url; sURL += 'id=' + $("[name=rbtn_mother_type]:checked").val(); sURL += '&industry_list=' + industry_list.join(','); // window.location.href = sURL; } // $(document).ready(function() { init(); });