jquery radio button values
by toubia95
HTML
<fieldset>
<legend>Votre réponse</legend>
<label><input type="radio" name="Q1" value="oui">OUI</label>
<label><input type="radio" name="Q1" value="2">NON</label>
<label><input type="radio" name="Q1" value="MAYBE">PEUT-ÊTRE</label>
</fieldset>
<div class=" answer-container col-12">
<ul class="ls-answers answers-list radio-list list-unstyled " role="radiogroup" aria-labelledby="ls-question-text-839424X81998X1170142">
<li id="javatbd839424X81998X1170142S4011" class="answer-item radio-item">
<input type="radio" value="S4011" name="839424X81998X1170142" id="answer839424X81998X1170142S4011" onclick="if (document.getElementById('answer839424X81998X1170142othertext') != null) document.getElementById('answer839424X81998X1170142othertext').value='';checkconditions(this.value, this.name, this.type)">
<label for="answer839424X81998X1170142S4011" class="control-label radio-label">
1. <span style="background-color:#f4b39b;">Opération arithmétique symbolisée par le signe +. [<i>Il pose ses additions dans son cahier de brouillon.</i>]</span>
</label>
</li>
<li id="javatbd839424X81998X1170142S4012" class="answer-item radio-item">
<input type="radio" value="S4012" name="839424X81998X1170142" id="answer839424X81998X1170142S4012" onclick="if (document.getElementById('answer839424X81998X1170142othertext') != null) document.getElementById('answer839424X81998X1170142othertext').value='';checkconditions(this.value, this.name, this.type)">
<label for="answer839424X81998X1170142S4012" class="control-label radio-label">
2. <span style="background-color:#95a7f7;">Action d’ajouter. [<i>Le tissu est rendu plus souple par addition d’élasthanne.</i>]</span>
</label>
</li>
<li id="javatbd839424X81998X1170142S4013" class="answer-item radio-item">
<input type="radio" value="S4013" name="839424X81998X1170142" id="answer839424X81998X1170142S4013" onclick="if...
JavaScript
$( document ).ready(function() {
let result = [];
// let startTime = performance.now();*/ /* floating pooint millisecond (microsecond precision)
let startTime = Date.now(); /* millisecond */
$( 'input[name="Q1"]' ).on( "change", function() {
// $( 'input[name="Q1"]' ).on( "change click", function() {
// result.push($( 'input[name="Q1"]:checked').val());
// result.push([$( 'input[name="Q1"]:checked').val(),performance.now() - startTime]);
// result.push([$( 'input[name="Q1"]:checked').val(),Date.now() - startTime]);
result.push([$( 'input[name="Q1"]:checked').val(),(Date.now() - startTime)/1000]);
console.log(result);
} );
});
/*
// Track changes
$( document ).ready(function() {
const code_question = "{GS401101.sgqa}";
let startTime = Date.now();
let tracked_changes = [];
let current_question = 'input[name="' + code_question +'"]';
$(current_question).on( "change", function() {
tracked_changes.push($(current_question+':checked').val() + "@" + (Date.now() - startTime)/1000 + "s");
console.log(tracked_changes.join(", "));
} );
});
*/