Writing a simple alert code in Jquery

Recently I was fixing a bug in Mediawiki where I had to write the 
confirmation code. I had no idea working with Javascript, I did manage to 
get this one done. Here are a few basic steps on how to get this done.
I 'm having two parameters, title and description and I have to write a
confirmation code to check whether if some data has been changed. 

Declare the two variables title and desciprition.
      
         var title = 'input title';
         var description = 'input.description';

Check if the data has been changed in the title or description.

   this.$( 'input.title', '.description' ).change( checkEdited ); 
//Here checkEdited is a function to show an alert message.
//change is a selector that you use to chekc if any change has been
made.

Write the function checkEdited.

        var checkEdited = function() {
             alert ('This is a test');
        };

Make sure when you are writing the fucntion write the function before
you call the onChange fucntion.



 




					
Advertisements

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