jQuery – A fluent JavaScript API

Nowadays you read more and more about DSL and Fluent APIs / Fluent Interface, which I was to reminded when I bumped into jQuery today (by doing some JS related work).

In jQuery you can do things like:

  $('<p></p>')
  .html("Blah, blah, blah")
  .addClass("foobar")
  .appendTo("body");

This code simply adds a new paragraph to the current page, nothing special with that, but it is done with a very sexy and well readable syntax. It is truly worth to evaluate jQuery in detail!

Howdy!

Posted in javascript, web²
One comment on “jQuery – A fluent JavaScript API
  1. Yoav Shapira says:

    jQuery is a fantastic library. I’ve been using it for more than a year now, and I can’t tell you how happy I am with it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: