+ 2

I'm trying to check if there was a click on a special button or on the document itself by the: if (... || ...) { }

There is a dropdown-item "Product" in the Menu. After the first click on this item, the menu will become 270px long. And I want to the second click on "Product" or on the document make the menu 200px long again. The code there is in tags /*Start*/ and /*End*/ https://code.sololearn.com/WwxoqRcQTeNu/?ref=app

6th Aug 2020, 12:29 PM
Pavel Durov
Pavel Durov - avatar
5 odpowiedzi
+ 1
See if you logout the following console.log($(".dropdown-toggle").click); It prints a function ,it isn't returning like true or false
6th Aug 2020, 1:12 PM
Abhay
Abhay - avatar
+ 1
Abhay Then how can i check which of the two elemet was clicked ?
6th Aug 2020, 6:07 PM
Pavel Durov
Pavel Durov - avatar
0
Why aren't you using that var I =0 ; Concept here also onclick funcrion(){ That globally var I =0; And if(I=0) {do 270 ; and I=1; } If(I=1){do 200; and I=0 ; } } It will work here also Afterall jQuery is library of js.
6th Aug 2020, 1:43 PM
Divya Mohan
Divya Mohan - avatar
0
If you are using jQuery I will suggest you to use toogle instead of dropdown .it will also look nice;
6th Aug 2020, 1:45 PM
Divya Mohan
Divya Mohan - avatar