Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions won't pop up??? #1

Open
Acotto561 opened this issue Jul 12, 2019 · 9 comments
Open

Questions won't pop up??? #1

Acotto561 opened this issue Jul 12, 2019 · 9 comments

Comments

@Acotto561
Copy link

// Initial Values
let counter = 30;
let currentQuestion = 0;
let score = 0;
let lost = 0;
let timer;

// Display questions an Choices in the broswer

function loadQuestion() {

var question = quizQuestions[currentQuestion].question; //
var choices = quizQuestions[currentQuestion].choices; //

$("#game").html("

" + question + "

");

}

loadQuestion(); this code does not pop up questions

@accimeesterlin
Copy link
Owner

Can you also share your index.html code as well?

@Acotto561
Copy link
Author

<title>Trivia Game</title>
<div class="container">
  
  <div class="jumbotron">
    <h1>Trivia Game</h1>
    <button class="btn btn-primary" id="start">Start Game</button>
  </div>
  
  <h2 id= "time"></h2>
<div class="game"></div>
  
  </div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <script src="question.js"></script> <script src="app.js"></script>

@accimeesterlin
Copy link
Owner

Can you also share the question.js code as well?

@Acotto561
Copy link
Author

Acotto561 commented Jul 12, 2019 via email

@Acotto561
Copy link
Author

Acotto561 commented Jul 12, 2019 via email

@Acotto561
Copy link
Author

// Initial Values
let counter = 30;
let currentQuestion = 0;
let score = 0;
let lost = 0;
let timer;

// Display questions an Choices in the broswer

function loadQuestion() {

var question = quizQuestions[currentQuestion].question;
var choices = quizQuestions[currentQuestion].choices;

$("#game").html("

" + question + "

");

}

loadQuestion(); //app.js

@Acotto561
Copy link
Author

so i put this in the console to see what it said...... $ ("#game").html ("

"+question+"

");
VM27:1 Uncaught ReferenceError: question is not defined
at :1:26

@accimeesterlin
Copy link
Owner

accimeesterlin commented Jul 13, 2019

Try this
$("#game").html(question);

I also notice that inside your index.html. You don't have an id named game, instead of you have a class.

Instead of

<div class="game"></div>

Try

<div id="game"></div>

@Acotto561
Copy link
Author

I had to put a onclick in the button tag to get the question to show.... but the choices wont show. neither did the timer... I have no clue where im going wrong because i am following you...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants