diff --git a/js/snake.js b/js/snake.js index b78f1ae..5531235 100644 --- a/js/snake.js +++ b/js/snake.js @@ -184,6 +184,22 @@ $(document).ready(function () { }) + } + function addTextToAnserws(randomQuestion) { + var i = 0; + var j = 2; + console.log(randomQuestion[1].value); + var inputsArrNo = $(".no"); + var inputNo0 = $(inputsArrNo[0]); + var inputNo1 = $(inputsArrNo[1]); + var inputNo2 = $(inputsArrNo[2]); + inputNo0.next().text(randomQuestion[2].value); + inputNo1.next().text(randomQuestion[3].value); + inputNo2.next().text(randomQuestion[4].value); + + $('h3').text(randomQuestion[0].value); + $('.yes').next().text(randomQuestion[1].value); + } function showQuestionTask() { @@ -210,14 +226,10 @@ $(document).ready(function () { if(randomQuestion === null){ alert('Pytania nie zostaly dodane. Wciśnij Ok, następnie F5 i dodaj pytania'); } - - $('h3').text(randomQuestion[0].value); - $('#yes').text(randomQuestion[1].value); - $('#no_one').text(randomQuestion[2].value); - $('#no_two').text(randomQuestion[3].value); - $('#no_three').text(randomQuestion[4].value); - $('#popup').fadeIn(); randomYes(); + addTextToAnserws(randomQuestion); + $('#popup').fadeIn(); + // $(".popup-item").each(function(index){ // var newId = "yes"; diff --git a/snake.html b/snake.html index a637783..870ddaa 100644 --- a/snake.html +++ b/snake.html @@ -25,10 +25,10 @@