jQuery Custom Events 2

Check first my last post about jQuery Custom Events.

We can create a custom event with more than one handler! It is simple as this:


$("div").bind("doSomething.func1", fn1);
$("div").bind("doSomething.func2", fn2);
$("div").trigger("doSomething");

Check a little example on jsFiddle

Advertisements

Tip of the week – run html pages from Github

Did you know you could easily run an HTML page from Github?

The solution is rawgithub !

Just go to the file you would like to run and click on raw button. This will show the page but served as text/plain and not text/html.

So that you run the file as text/html on the url just delete the dot from rawgithub.

Before:

https://raw.github.com/nmoliveira/requirejs-demo/master/blog.html

After:

https://rawgithub.com/nmoliveira/requirejs-demo/master/blog.html

Very nice to share code or show some demos, but, beware, this is not for production! This is not an alternative to hosting services!

Check Can I use rawgithub.com on a production website?