javascript - Bootstrap radio select through Jquery not working -


i have created jquery quiz. answer choices radio buttons. whenever answer choice clicked, code determines whether right or wrong , sends message dom. however, clicking right answer sends message wrong. think must due bootstrap or way set code. pls help.

   (var = 0; < choices.length; i++) {                 $(document.createelement('label')).addclass(                         'c-input c-radio').appendto('#choice-block')                     .attr('id', i);                 $(document.createelement('input')).appendto('#' + i)                     .attr('type', 'radio').attr('id', * 100);                 $(document.createelement('span')).addclass(                     'c-indicator').appendto('#' + i);                 $(document.createelement('span')).appendto('#' + i)                     .text(choices[i]);                 $(document.createelement('hr')).appendto(                     '#choice-block');             } 

and here's code runs whenever answer choice clicked:

$('.c-input.c-radio').on('click', function() {             $(this).find('input').prop('checked', true).attr('checked', 'checked');  } 

thank much.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -