+ 1
jQuery selector as a variable not working.
I tried to put a variable at the place of a selector but it fires automatically without click function. What is the problem? https://code.sololearn.com/Wj9IxEiIiz80/?ref=app
6 Answers
+ 3
In the very 1st line you should use the click event instead of ready.
If u use ready event the function will execute as soon as the window loads
Use the click event handler to make the function execute when clicked
https://code.sololearn.com/WZ7bod4Dp959/?ref=app
+ 3
Hey, I solved it ...just take a look
https://code.sololearn.com/WGFmRF597APj/?ref=app
+ 2
I wanted the selector to be a variable ...
+ 1
@AkshatVira but it fires off when we click anywhere on the screen.
+ 1
I'll try to get a solution ...
+ 1
okay thank you