Its barely been 1 week and I am already missing out the loveliness of YUI and have to work on JQuery, not saying its bad just missing out on the lack of verbosity that JQuery has to offer.
I had to implement custom events on JQuery found this kind of working for what I needed it to do. Not so sure if this was the most ideal way to do it, but would be worth getting your views on it.
$(document).ready(function() {
$(document).bind('custom-event', doSomething);
$(document).bind('custom-event', doAnotherthing);
$('#some_name').click(function() {
$(document).trigger('custom-event', ['foo1', 'foo2']);
});
});
function doSomething(e, param1, param2) {
console.log(arguments);
console.log('doing something..');
}
function doAnotherthing(e, param1, param2)
{
console.log(arguments);
console.log('doing another thing..');
}


Recent Comments