+ 4

I made a questionnaire in Javascript

When the test is passed, it gives the user a happy message, but I bet the message will not be displayed until the user gives the correct answer. The condition is fulfilled. I mean the text is displayed but I wanted the message to be inside a <div>. There is a problem here. That the text itself is displayed when the correct answer is provided, but <div> does not accept this condition is available from the beginning of the program .... Why?

27th Jun 2022, 11:54 AM
Rahima Mirzad
Rahima Mirzad - avatar
16 Answers
+ 4
Yes I understand that. With your code as is, #demo div (your message) appears outside of the the .container div The .container div holds the .grid div which holds the .quiz div. The .quiz div is the div that holds the questions and the results of the quiz after the last question is answered. My question to you is where do you want the message to appear inside one the divs mentions above or outside of the all them? Code below I placed the message inside of the .quiz div, it will appear right underneath the results when the quiz is done. https://code.sololearn.com/WgF7x5QhB2D9/?ref=app
27th Jun 2022, 5:44 PM
ODLNT
ODLNT - avatar
+ 2
Rahima Mirzad First lets get rid of the extra characters causing the css problem. https://i.imgur.com/iqix9js.png https://code.sololearn.com/WnSkp7788z0J Now that we can see the big picture(your code), your question/issue is clearer. When the quiz is over the results are shown inside of a box/ container, and your message appears underneath. Where would you like your message to be displayed?
27th Jun 2022, 4:57 PM
ODLNT
ODLNT - avatar
+ 1
Rahima Mirzad when i copied your code there was a double quote missing but i don't know , now it looks fine . It should work fine now.
27th Jun 2022, 12:46 PM
Abhay
Abhay - avatar
+ 1
Rahima Mirzad i just don't see what is wrong with the code , it works fine for me when i run it on sololearn . Are you running it on sololearn or somewhere else ?
27th Jun 2022, 1:01 PM
Abhay
Abhay - avatar
27th Jun 2022, 2:13 PM
Rahima Mirzad
Rahima Mirzad - avatar
+ 1
Rahima Mirzad what is wrong with this code except the "quiz.score== 4" which should be quiz.score== 5 instead.
27th Jun 2022, 4:23 PM
Abhay
Abhay - avatar
+ 1
ODLNT Thanks alot 😊😇 Solved
27th Jun 2022, 5:49 PM
Rahima Mirzad
Rahima Mirzad - avatar
+ 1
Rahima Mirzad something like this edited: In line 453 "=" replaced with "+=" https://code.sololearn.com/WO6sOLqP3115/?ref=app
28th Jun 2022, 7:45 AM
SAN
SAN - avatar
0
<div id="demo" style=" width: 300px; height:300px; margin :aotu; background-color : red; padding: 5px 25px 25px 25px; border-radius: 25px ; border: 2px solid red ; box-shadow: 10px" > </div> In JS code: if(qiuze.score==4) { document.getElementById("demo").innerHTML = " Congratulations 👏 "; /* 4 is the number of correct answers */
27th Jun 2022, 11:54 AM
Rahima Mirzad
Rahima Mirzad - avatar
0
Abhay No, there is no mistake there. I wrote correctly on my computer 🤦‍♀️
27th Jun 2022, 12:43 PM
Rahima Mirzad
Rahima Mirzad - avatar
0
Abhay On my computer. Code is correct but not worked🤦‍♀️ Please help 🙏
27th Jun 2022, 12:50 PM
Rahima Mirzad
Rahima Mirzad - avatar
0
I run on pc but don't work
27th Jun 2022, 1:11 PM
Rahima Mirzad
Rahima Mirzad - avatar
0
Hi Rahima, I don't understand this part "but <div> does not accept this condition is available from the beginning of the program..." What condition not accepted? Please clarify this part ...
27th Jun 2022, 1:37 PM
Ipang
0
Nobody understood what I wanted to say......😭✋
27th Jun 2022, 4:35 PM
Rahima Mirzad
Rahima Mirzad - avatar
0
@ODLNT I just want the div tag used in the message field to be displayed at the end of the questions. After checking the condition
27th Jun 2022, 5:07 PM
Rahima Mirzad
Rahima Mirzad - avatar
0
سلام من تازع وارد این برنامه شدم میشه ی کمکی بهم بکنید؟!
29th Jun 2022, 5:15 AM
Farzane Pit
Farzane Pit - avatar