I ve been learning JQuery, and everything was clear. Until I reached the strings.
So far I knew that when you want to call something you do it this way $('callSomething')
. Now Im learning how to move html elements around, and it was written to call something with double comment lines $("callSomething")
.
I started playing around the code, and I ve noticed that no matter what I will use ' '
or " "
the code will work.
$('#one').after("<p>test</p>");
var $p = $("p");
$("#two").after($p)
Now I'm not sure what to use where. I understand that " "
is used to call Strings. But I could use it to call elements too.
My question:
Is there a specific reason when to use ' '
? Or should I always use " "
since its working and save myself the confusion?
Any explanation maybe on when to use ' '
and when '" "(if there is actual difference between them other than calling a string
("< .p>test<./ p >")`?
Thank you for your time