What is the difference between using this
$('.container').text();
and this:
$(".container").text();
both ("
) and ('
) work but what's the difference?
What is the difference between using this
$('.container').text();
and this:
$(".container").text();
both ("
) and ('
) work but what's the difference?
The long and short of it is that there is no difference whatsoever.
There is no difference in this case, you can use either apostrophes ('
) or quotation marks ("
) to delimit strings in Javascript.
Where you can see a difference, is when you need to use apostrophes or quotation marks inside a string. If you delimit a string using apostrophes, you have to escape apostrophes inside the string, but not quotation marks, and vice versa.
Example:
var html = '<div class="info"></div>';
vs.
var html = "<div class=\"info\"></div>";
They are the same, there is no difference, just a coding convenience.
There is no difference, except for when you want either double or single quotes to appear inside your string:
$(".continer[rel='hello']");