{"action":"closed","issue":{"url":"https://api.github.com/repos/ga-dc/pbj-project1/issues/91","labels_url":"https://api.github.com/repos/ga-dc/pbj-project1/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/ga-dc/pbj-project1/issues/91/comments","events_url":"https://api.github.com/repos/ga-dc/pbj-project1/issues/91/events","html_url":"https://github.com/ga-dc/pbj-project1/issues/91","id":94810780,"number":91,"title":"Help request -- variable issue","user":{"login":"leighvarley","id":12813818,"avatar_url":"https://avatars.githubusercontent.com/u/12813818?v=3","gravatar_id":"","url":"https://api.github.com/users/leighvarley","html_url":"https://github.com/leighvarley","followers_url":"https://api.github.com/users/leighvarley/followers","following_url":"https://api.github.com/users/leighvarley/following{/other_user}","gists_url":"https://api.github.com/users/leighvarley/gists{/gist_id}","starred_url":"https://api.github.com/users/leighvarley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leighvarley/subscriptions","organizations_url":"https://api.github.com/users/leighvarley/orgs","repos_url":"https://api.github.com/users/leighvarley/repos","events_url":"https://api.github.com/users/leighvarley/events{/privacy}","received_events_url":"https://api.github.com/users/leighvarley/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-13T21:00:48Z","updated_at":"2015-07-14T14:57:36Z","closed_at":"2015-07-14T14:57:36Z","body":"I'm having issues referencing my variable in the second alert in the code below.\r\nI thought that :\r\n-I set var q1answer equal to the value of the line where the value q1correct was checked\r\n-By doing so I'd be to reference the value of var q1answer in line 7 below.\r\n-Instead, line 7 gives an alert indicating that q1answer is undefined.\r\n-This seems odd to me because the code is correctly identifying whether the answer is right or wrong, so the reference to q1answer seems to be working in line 3. \r\n\r\n\r\n( \"input[id='q1submit']\" ).on( \"click\", function() {\r\n  var q1answer = $(\"input[value='q1correct']:checked\").val();\r\n  if (q1answer) {\r\n    alert(\"Correct!\")\r\n  }\r\n  else {\r\n    alert(\"Incorrect. The correct answer is \" + q1answer + \".\")\r\n  }\r\n})"}}