Function in JQuery

Once i want to execute same set of codes for two common events in jquery. ie, i want to execute the code while

1 . Changes occur in dropdown

2 . While page Load.

At, that time i planned to use bind() function.But if i use bind() i should use the same code for two times.So, i planned to implement that using OR( || ) condition.But, i think it is not available..So i searched jquery.com & finally got one beautiful solution.

That Solution is Normal FUNCTION ( ) like C,C++.i call this function two times only with one set of code.That example is below..

Example:

$(“#level”).change( changes );          // call – 1
$(document).ready( changes );         // call – 2

function changes()

{

——

Set of code

——

}
Reference : http://api.jquery.com/bind/

  1. No comments yet.
  1. No trackbacks yet.

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: