All jQuery Tips

Different ways to refresh or reload page using jQuery

In this post, I will show you the different ways using which you can reload or refresh the webpage using jQuery. The first method is nothing to do with jQuery. It is a HTML tag which you need to put in the head section of your page and your page will get refreshed automatically after […]
Read the rest of this entry »

How to put link on image using jQuery

To put link of the image, we normally use <a> tag that contains image tag to show the image. But assume there are 100 images and you need same link for every single image. Putting 100 <a> tag with each image is time consuming and cumbersome. It would be nice if single <a> tag can […]
Read the rest of this entry »

How to Disable Spacebar in text box using jQuery

For one of my requirement, I need to restrict/disable end-user to enter space in the input field or textbox. This was piece of cake with jQuery. All I need to do is to check the keycode of spacebar and restrict its default action on keydown event. See below jQuery code. "txtNoSpaces" is the name of […]
Read the rest of this entry »

How to Set focus on First textbox of page using jQuery

In any webpage where there are lots of input controls and you want the foucs on the first text box when the page is loaded. It is a piece of cake with jQuery. See below code. $(document).ready(function() { $('input:text:first').focus(); }); See live Demo and Code. But there could be one problem with this approach, if […]
Read the rest of this entry »

How to load jQuery locally when CDN fails

There are couple of advantage if you load your jQuery from any CDN. Read my post about "jQuery Tip : Always load your jQuery framework from CDN". It is a good approach to always use CDN but sometimes what if the CDN is down (rare possibility though) but you never know in this world as […]
Read the rest of this entry »

Find which mouse button clicked using jQuery

For one of my requirement, I need to determine which mouse button (Left, Middle or Right) was clicked. jQuery provides mousedown() event, using which we can check which mouse button is clicked. For key or button events, event attribute indicates the specific button or key that was pressed. event.which will give 1, 2 or 3 […]
Read the rest of this entry »

Responsive Menu
Add more content here...