if (row >= 0 && row < dataRows.length) { let foundRow = dataRows[row]; // Populate the HTML with data from the found row // document.getElementById('questionNumber').innerText = 'প্রশ্ন নং: ' + foundRow[0] ; document.getElementById('questionNumber').innerHTML = 'Q:' + (currentRow+1) + '/' + dataRows.length; document.getElementById('chapterName').innerHTML = 'অধ্যায়: ' + foundRow[1]; document.getElementById('questionType').innerHTML = 'ধরন: ' + foundRow[2]; document.getElementById('questionText').innerHTML = foundRow[0] + foundRow[3]; document.getElementById('answerText').innerHTML = 'উত্তর: ' + dataRows[currentRow][4]; // Display the image if the image link exists if (foundRow[5] && foundRow[5] !== '') { document.getElementById('questionImage').src = foundRow[5]; document.getElementById('questionImage').style.display = 'block'; } else { document.getElementById('questionImage').style.display = 'none'; } } else { document.getElementById('questionNumber').innerText = 'No more results'; document.getElementById('chapterName').innerText = ''; document.getElementById('questionType').innerText = ''; document.getElementById('questionText').innerText = ''; document.getElementById('answerText').innerText = ''; document.getElementById('questionImage').style.display = 'none'; }