0

That is JavaScript QUESTION.

Hi everyone. I created a function which is going to open and close the Menubar but every Time as i run the code, i received an error like "Uncaught TypeError: Cannot read property 'style' of null". I could not analyze the error can someone take a look on my code and help me with that? Thanks

28th Aug 2019, 11:45 AM
Ahmad
Ahmad - avatar
14 Réponses
28th Aug 2019, 3:58 PM
r8w9
r8w9 - avatar
+ 6
Ahmad Hi, please post your code.
28th Aug 2019, 12:20 PM
r8w9
r8w9 - avatar
+ 5
Ahmad great, if it's correct then mark this answer as best (green tick) to prevent others work on solved solution. Also, please don't use margins, use .style.display instead :)
28th Aug 2019, 4:37 PM
r8w9
r8w9 - avatar
28th Aug 2019, 12:49 PM
Bono
Bono - avatar
+ 1
28th Aug 2019, 12:26 PM
Ahmad
Ahmad - avatar
+ 1
Hi Coder. Thanks for Answer. I did the same as you mentioned but still, i have the same problem. I stuck till now with the same problem.
28th Aug 2019, 1:31 PM
Ahmad
Ahmad - avatar
+ 1
Thanks Dear r8w9 That is a great answere🙏✌👏if you some solution that i can do it with margin, please share me. thanks
28th Aug 2019, 4:25 PM
Ahmad
Ahmad - avatar
+ 1
Thanks dear r8w9 fot your cooperation i did it✅
28th Aug 2019, 4:49 PM
Ahmad
Ahmad - avatar
0
Dear thanks for your response, i did it but i recieved another error which is not define the menuToggle in arrow function as i define it i recieve another error. which say Malformed arrow function parameter list
28th Aug 2019, 12:00 PM
Ahmad
Ahmad - avatar
0
HI Bono. unfortunately, it does not work for me, i mean when the window loaded the list is not going to be clear on the website, when i click the menu it has to be closed and open the list. That is the reason that i defined the marginRight = "-300px";
28th Aug 2019, 1:00 PM
Ahmad
Ahmad - avatar
0
Hi CODER: As you see in the HTML File, I have the Link tag which takes the Menu and i have as also a list inside the HTML File. i styled it simple in the CSS File. i wrote the JS code to change the style and the behavior of the List. As the browser will load, the List should be closed or unvisible. As i click the Menu it should open the List according to the width = 300px; as i click it again it should close or be unvisible(That is the reason which i define the marginRight = " - 300px";)
28th Aug 2019, 3:18 PM
Ahmad
Ahmad - avatar