All jQuery Interview Question

Is window.onload is different from document.ready()

window.onload() is traditional Java script code which is used by developers from many years. This event is gets called when the page is loaded. But how this is different from jQuery document.ready() event? Well, the main difference is that document.ready() event gets called as soon as your DOM is loaded. It does not wait for […]
Read the rest of this entry »

jQuery empty() vs remove()

jQuery provides 2 methods empty() and remove() to remove the elements from DOM. I have seen the programmers getting confused between both the methods. empty() method removes all the child element of the matched element where remove() method removes set of matched elements from DOM. Confused? Let me explain you with an example. There are […]
Read the rest of this entry »

What is jQuery.noConflict()

What is jQuery.noConflict()? Well, jQuery is popular because there are plenty of useful, simple and easy to use plugins. But while using jQuery plugins, sometimes we include other libraries like prototype, mootools, YUI etc. The problem comes when one or more other libraries are used with jQuery as they also use $() as their global […]
Read the rest of this entry »

jQuery Tip – How to check if element is empty

In this post, I will show you a simple tip to check or verify that the element that you are accessing in jQuery is empty or not. jQuery provides a method to get and set html of any control. Check these articles for more details. Get HTML of any control using jQuery Set HTML of […]
Read the rest of this entry »

Difference between $(this) and ‘this’ in jQuery

Before writing this post, I was also confused about '$(this)' and 'this' in jQuery. I did some R&D and found out the difference between both of them. Let's first see how do we use them. $(document).ready(function(){ $('#spnValue').mouseover(function(){ alert($(this).text()); }); }); $(document).ready(function(){ $('#spnValue').mouseover(function(){ alert(this.innerText); }); }); Got any idea about the difference? this and $(this) refers […]
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...