Use double quotes and not working. Single quotes and it's working....wait but why?


#1

So here is the jquery code which didn't work :

var main=function()
{
$(".icon-menu").click();
};
$(document).ready(main);

and here is the error: > "Oops, try again. Use the line $('.icon-menu').click(); inside your main function."
It worked just fine with single quotes though.
I assumed it does not matter as long as opening and closing quotes are both either single or double. Can we only use single quotes and not double ?


#2

Hi Rahul,

Single versus double quotes won't affect JavaScript/jQuery code in real life, but on Codecademy this lesson has a poorly done SCT (Submission Correctness Test; code checker), so you have to be careful and use single quotes most of the time here :confused:


#3

Thanks Zystvan. That helped :smile: