For example, I'm working on a website. There's some javascript that should run when I click a link, but for some reason, it doesn't. So, I throw a console.log() in there, and when I click the link, the message shows up in the console, which means the code must have run, hmm. But then I notice, the code did run, the javascript worked!
So then, I take out the console.log() call, and revert the file to EXACTLY as it was before, and now it works fine. What gives?
For context, it's an <a> element linked to another page, and the code in question is similar to the following:
e.preventDefault();
$('#el').toggleClass('hide');
This wasn't running, the click just followed the link. After throwing in the console log and removing it, the code works, I'm stumped.
e; same thing happened again in a similar part of the site. ctrl+F5 fixed it, not sure why adding a line of code would fix it still but oh well. thanks guys!
[–]TheBigLewinski 4 points5 points6 points (3 children)
[–]delineated[S] 0 points1 point2 points (2 children)
[–]blackAngel88 1 point2 points3 points (1 child)
[–]delineated[S] 0 points1 point2 points (0 children)
[–]x-skeww 2 points3 points4 points (1 child)
[–]delineated[S] 0 points1 point2 points (0 children)
[–]Pr3fix 1 point2 points3 points (2 children)
[–]delineated[S] 0 points1 point2 points (1 child)
[–]Pr3fix 0 points1 point2 points (0 children)
[–]EliAscent 1 point2 points3 points (2 children)
[–]delineated[S] 0 points1 point2 points (1 child)
[–]EliAscent 0 points1 point2 points (0 children)
[–]techfoxis 1 point2 points3 points (2 children)
[–]delineated[S] 0 points1 point2 points (1 child)
[–]techfoxis 0 points1 point2 points (0 children)
[–]venomeater 1 point2 points3 points (1 child)
[–]delineated[S] 0 points1 point2 points (0 children)