DEPENDENT COLUMNS OF ANOTHER

More
1 year 4 months ago - 1 year 4 months ago #181750 by FERNANDA1206
Hi,

I have a matrix with different response types in its rows but I would like column 5 to depend on column 4, that is, if it has the value of 1, the field to write the value is enabled, I have the following code but I have already modified it and does not allow me....
They could help me..

var showValue = '1';
$('.answer-item.answer_cell_SQ005 select', thisQuestion).on('change', function(e) {
var thisValue = $(this).val();
var thisCode = $(this).closest('.answer-item').find('input:text').attr('id').split('_')[1];
var otherInput = $('.answer-item.answer_cell_SQ006'+thisCode+' input:text', thisQuestion);
if(thisValue == showValue) {
$(otherInput).show();
}
else {
$(otherInput).hide().val('');
checkconditions($(otherInput).val(), $(otherInput).attr('name'), 'text');
}
});
// Initial states of row-4 inputs
$('.answer-item.answer_cell_SQ006 input:text', thisQuestion).hide();
$('.answer-item.answer_cell_SQ005 .inserted-select', thisQuestion).each(function(i) {
var thisValue = $(this).val();
var thisCode = $(this).closest('.answer-item').find('input:text').attr('id').split('_')[1];
var otherInput = $('.answer-item.answer_cell_SQ006'+thisCode+' input:text', thisQuestion);
if(thisValue == showValue) {
$('.answer-item.answer_cell_SQ006'+thisCode+' input:text', thisQuestion).show();
}
});
Attachments:
Last edit: 1 year 4 months ago by FERNANDA1206. Reason: Because I add the matrix example
The topic has been locked.
LimeSurvey Partners

Start now!

Just create your account and start using Limesurvey today.

Register now