All jQuery Methods

How to use jQuery slideToggle function

In this post, I will show you how can you toggle any element based on any event. For example, on click of any button you want to show/hide any div element. You can easily achieve this by setting css of the div. I will show you how you can achieve it using jQuery without setting […]
Read the rest of this entry »

Difference between jQuery parent() and parents() methods

In this post, we will see what is the difference between parent() and parents() methods. To understand this, let's look at the below given html code. <html> <body> <form id="form1" runat="server"> <div id="dvParent"> <div id="dvChild"> <p><span id="spnText">jQuery By Example Rocks!!!</span> </p> </div> </div> </form> </body> </html> As you see there 2 divs, 1 p and […]
Read the rest of this entry »

jQuery delegate method Example/Demo

With jQuery 1.4.2 launch, a new method called "delegate()" was introduced. This method attaches a handler to one or more events for selected/specified elements. Let's take an example. I have created a table and using delegate method, I will attach the click event handler to every td element. <table border="1" width="200px" cellspacing="5" cellpadding="5"> <tr> <td>Item […]
Read the rest of this entry »

jQuery – bind() vs live() vs delegate() methods

I had already posted about jQuery bind(), jQuery live() and  jQuery delegate() functions. All the three jQuery functions are used to attach events to selectors or elements. But just think why there are 3 different functions for same purpose? There can't be. right? So in this post, I will explain you how these functions are […]
Read the rest of this entry »

How to remove space from begin and end of string using jQuery trim

Below jQuery code remove spaces from begin and end of string using trim function of jQuery. $(document).ready(function(){ var strVal = " jQuery By Example "; strVal = jQuery.trim(strVal); alert(strVal); }); When you run this code, "jQuery By Example" will be displayed in alert box. trim() will remove the space from begin and end of any […]
Read the rest of this entry »

How to highlight on mouseover using jQuery

In this post, I will show you a tip/trick to provide highlighting effect on mouseover and mouseout. For demo purpose, we will create a css class which will set the background color of element. This css class will be added to element on mouseover and it will be removed on mouseout. To achive this, we […]
Read the rest of this entry »

Responsive Menu
Add more content here...