- Posts: 42
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); $('.answer-item.answer_cell_X002', thisQuestion).addClass('quantity'); $('.answer-item.answer_cell_X004', thisQuestion).addClass('amount'); $('.answer-item.answer_cell_X005', thisQuestion).addClass('sum'); $('.sum input[type="text"]', thisQuestion).prop('readonly', true); $('.quantity', thisQuestion).on('change', function(i) { if($(this).closest('.answer-item').hasClass('answer_cell_X002')) { handleSum($(this)); } }); $('.amount', thisQuestion).on('change', function(i) { if($(this).closest('.answer-item').hasClass('answer_cell_X004')) { handleSum($(this)); } }); function handleSum(thisSelect) { var thisRow = $(thisSelect).closest('tr.subquestion-list'); var item2 = $('.answer_cell_X002', thisRow); var item4 = $('.answer_cell_X004', thisRow); var item5 = $('.answer_cell_X005', thisRow); var w1=$('input:text', item2).val(); var w2=$('input:text', item4).val(); var w3=(w1*w2).toFixed(2);; if(w3>0) { $('input:text', item5).val('R$ ' + w3).trigger('change'); } else { $('input:text', item5).val('').trigger('change'); } } }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.