JSFiddle - React, Tailwind, and code Playground
by dixalex
JavaScript
//Developed to decrease load on Verint platform due to generating extraneous year punches.
function LoadPage8() {
$('.question:first input[type="text"]:first').addClass('hidden');
var select_age = $("<select></select>");
var min_year = 1;
var max_year = 12;
var month_arr = $('.month_array').text().split(',');
$(select_age).html(function() {
var select_children = "<option value='0'>" + $('.dd_text').text() + "</option>";
for (i = (min_year), z = (max_year); i <= z; i++) {
if (parseInt(i, 10) === max_year) {
select_children = select_children + "<option value='" + i + "'>" + month_arr[i - 1] + "</option>";
} else {
select_children = select_children + "<option value='" + i + "'>" + month_arr[i - 1] + "</option>";
}
}
return select_children;
});
$(select_age).insertAfter('.question:first input[type="text"]:first').on('change', function(evt) {
if (parseInt($(evt.target).val(), 10) > 0) {
$('.question:first input[type="text"]:first').val(parseInt($(evt.target).val(), 10));
} else {
$('.question:first input[type="text"]:first').val('');
}
});
console.log(select_age);
}
function LoadPage9() {
$('.question:first input[type="text"]:eq(1)').addClass('hidden');
var select_age = $("<select></select>");
var min_year = 1;
var max_year = 31;
$(select_age).html(function() {
var select_children = "<option value='0'>" + $('.dd_text').text() + "</option>";
for (i = (min_year), z = (max_year); i <= z; i++) {
if (parseInt(i, 10) === max_year) {
select_children = select_children + "<option value='" + i + "'>" + i + "</option>";
} else {
select_children = select_children + "<option value='" + i + "'>" + i + "</option>";
}
}
return select_children;
});
$(select_age).insertAfter('.question:first input[type="text"]:eq(1)').on('change', function(evt) {
if (parseInt($(evt.target).val(), 10) > 0) {
$('.question:first...