I have initialized 2 variables, var1
and $var2
under $(document).ready(function()
in jQuery. What is the main difference (or the possible differences) between these 2 variables?
var1 = "var1";
$var2 = "var2";
$('#click1').click(function() {
alert(var1);
});
$('#click2').click(function() {
alert($var2);
});
Here is the working fiddle.