Categories
JavaScript

each() function on JQuery

Use it to pass an anonymous function that will perform specific tasks on the element at hand. Example:

$('a[href^=http://]').each(function() {
  var extLink = $(this).attr('href');
  $('#bibList').append('<li>' + extLink + '</li>');
});
For all the links that do have an 'http://...' link, load extLink with the href of each one of them, and then append a list bullet with it.
Note how $(this) encapsules the argument element passed to the anonymous function.