I am new to JQuery. I wrote a small piece of code (fiddle). I was wondering if someone could throw some light on the order of execution of the statements i wrote.
The HTML:
<span>I</span>
<span>Love</span>
<span>JQuery</span>
The JavaScript:
$(function() {
$('<a>Url</a>').attr('href', 'http://www.jquery.com').appendTo('body');
$('<span>More</span>').appendTo('body');
$('span'.text());
});
I was expecting an output of Url I Love JQuery More but the output, as you can see, is I Love JQuery UrlMore. Why is the output in that order? Please help
$('span'.text())
to do?$('span'.text());
to be doing something. It does nothing (except possibly throw an error).