Event driven programming with jQuery – (part 2). Events in jQuery.

Well the “native” events in JavaScript are ‘onlick’, ‘onmouseover’, etc. I’m pretty sure that the term ‘native’ is not quite descriptive. OK. However even this can be called event driven programming.

The jQuery as usual simplifies the usage of this events and their handling. If you’ve some DOM with id ‘a’, i.e.:

document.getElementById('a').onclick = func();

In jQuery this comes with no browser dependencies, like:

$('#a').click(func);

That normally means that on click of that element, with id ‘a’, calls the func() method.

The need of event driven programming with JavaScript and jQuery is because in large scale applications you don’t need only click events. You’d like to call some method to be called on array change, or on style change or whatever! Than you can start using custom events, where jQuery again helps you a lot.

I’ll demonstrate in my next post how this can be implemented in a short example application.

Related posts:

  1. Event driven programming with jQuery – (part 1). What is event driven?
  2. Event driven programming with jQuery – (part 4). Simple event driven app.
  3. Event driven programming with jQuery – (part 3). What is a module?
This entry was posted in javascript, micro tutorial and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">