All jQuery Methods

How to find index of element in array using jQuery

Today, for my project requirement, I need to find out index of any element in jQuery. I found the solution. jQuery provides a method called "inArray" which search for the specified value in the array and returns the index of the element. Earlier I had posted about jQuery solution to remove item from array, split […]
Read the rest of this entry »

How to find index of Selected element

jQuery provides index() method to find out index of any element. index() method returns an integer value that indicates position of the element. If the element is not found then it returns -1. The index value starts from 0 which means 1st element value will be 0. See below code snippets which finds the index […]
Read the rest of this entry »

How to create clone of any object using jQuery

jQuery provides clone() method which creates deep copy set of all the elements which means it will copy the child nodes also. Clone() method is the best way to duplicate content of any element. For example, I have placed a div and a button. On click of button, we will clone the div and add […]
Read the rest of this entry »

jQuery Tip: How to Switch Css Class for elements

Have you ever come across a situation where you need to switch between two css classes for all the places where these classes are used? For example on click of button, you want to switch between class1 and class2. This can be easily achieved by jQuery. jQuery provides a method "switchClass" which allows you to […]
Read the rest of this entry »

How to Zoom an image using jQuery

You must had seen the zoom in and zoom out functionality for images on many sites. We can very easily achieve the Zoom In and Zoom Out functionality using jQuery toggle method. It is really simple. Let me first tell you the logic behind the implementation. Initially when document is ready then we will set […]
Read the rest of this entry »

width() vs css(‘width’) and height() vs css(‘height’)

jQuery provides two ways to set width and height of any element. You can set using css or you can use jQuery provided methods. If you want to set width to 100px then $('#dvText1').css('width','100px'); $('#dvText2').width(100); Then what is the difference? The difference lies in datatype. As its clear in code that with css method you […]
Read the rest of this entry »

Responsive Menu
Add more content here...