All jQuery Code Examples

Best Tips to Learn jQuery

jQuery is a programming script that runs on a browser, and it is a JavaScript library. When you learn it, the concept is to expand your knowledge of the system and the libraries, so it really isn’t that hard to grasp if you already use the other known programs.  Image: Unsplash There are several benefits […]
Read the rest of this entry »

jQuery: Restrict occurrence of specific word in textbox

Below jQuery code allows to restrict user to enter any specific word only once in textbox. For demo, I have used "article" word and it should occur only once in textbox. The code also makes case insensitive search. $(document).ready(function () { $('#txtDesc').bind('keyup', function () { var txtToMatch = /article/gi; var iLimit = 1; var sMatch […]
Read the rest of this entry »

Detect Scroll Position (Up/Down) using jQuery

Below jQuery code detects whether user is scrolling up or down in the webpage. var iScrollPos = 0; $(window).scroll(function () { var iCurScrollPos = $(this).scrollTop(); if (iCurScrollPos > iScrollPos) { //Scrolling Down } else { //Scrolling Up } iScrollPos = iCurScrollPos; }); Live Demo Feel free to contact me for any help related to jQuery, […]
Read the rest of this entry »

Remove Weekends From jQuery UI Datepicker

In this post, find jQuery code to remove weekends rather than disabling them from jQuery UI Datepicker. This is quite useful when you don't want to allow users to select weekends. To disable weekends, all you need to do is to override ".ui-datepicker-week-end" css class and set display to none. .ui-datepicker-week-end { display:none } Live […]
Read the rest of this entry »

Check for ‘#’ hash in URL using jQuery

In this short post, find jQuery code to check if URL contains "#" (hash) or not. This can be checked via location.hash property provided by JavaScript and same can be used in jQuery. $(document).ready(function(){ if(window.location.hash) { // # exists in URL } else { // No # in URL. } }); Feel free to contact […]
Read the rest of this entry »

Highlight first day of every month in jQuery UI Datepicker

With continuation of jQuery UI Datepicker series articles, here is another post which gives solution to highlight very first day of each month in jQuery UI Datepicker control. First, define a CSS class to show highlighted effect. .firstDay a{ background-color : #00FF00 !important; background-image :none !important; color: #000 !important; } And use "beforeShowDay" event provided […]
Read the rest of this entry »

Responsive Menu
Add more content here...