phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


jQuery: Using Event Handler

Tag: jQuery, javascript, event handler, event   Category: JavaScript
post: 20 Mar 2008 read: 483


JQuery Introduction Step By Step Tutorial - Part 4:We know, JavaScript have event handlers. Many handlers are available for user-initiated events, such as mouse clicks, key presses, load. In this post, we will see how to apply it.

In this practice, we use onload event at body. Like this:


<body onload="lyricstyle();">

For this purpose, we must modify our myjs.js. Modify it become like this:


// JavaScript Document
$(document).ready();

function lyricstyle(){
  $('.lyric-text').addClass('lyric-full');
}				  

We create new function: lyricstyle(). We don't put in $(document).ready(). What is impact? This causes our code to run after the page is completely loaded.



Series this article:
jQuery: Introduction
jQuery: Installation
jQuery: My First Code
jQuery: Using Event Handler

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting