jQuery n00b here...
I was going over some code, and was wondering if someone could explain part of it:
- $.getJSON('/functions.php', { get_param: 'value' }, function(data) {
- $.each(data, function(index, element) {
- $('body').append($('<div>', {
- text: element.name
- }));
- });
- });
My question is with regard to:
- $('<div>', { text: element.name })
My understanding from the docs is that is a selector with a context. How exactly does this work/what is it doing?
Thanks!