Every Web Developer Must Know This jQuery Code

jQuery extensively simplified web developer’s life and has become a leader in JavaScript available libraries. There are a lot of useful jQuery snippets available, but here in this post, we are going to share 7 basic and widely used code snippets that every front-end web developer must have. Even for those who are new to jQuery can easily understand and get benefit from these routinely used code snippets.


1. jQuery Code – Print Page Option

Providing option to print a page is a common task for web developers. Following is the available code:

2. jQuery Code – Select/Deselect All options

Selecting or Deselecting all available checkbox options using a link on HTML page is common task.

3.  jQuery Code – Disabling Right Click

For web developers, its common to disable right click on certain pages so following code will do the job:

4. jQuery Code – Helping Input Field/Swap Input Field

In order to make an Input Text field helpful, we normally display some default text inside it (For Example “Company Name”) and when user click on it, text disappears and user can enter the value for it. You can try it yourself by using the following code:

5. jQuery Code – Limiting MaxLength for TextArea

It usual to put a textarea on a form and validate maximum number of characters on it.

6. jQuery Code – Identify which key is pressed.

Sometimes, we need to validate the input value on a textbox. For example, for “First Name” we might need to avoid numeric values. So, we need to identify which key is pressed and then perform the action accordingly.

7. jQuery Code – Validating an email.

Validating an email address is very common task on HTML form.

Looking for ASP.NET Hosting on European Server? We can help you a lot!

hostforlifeasp.net is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.


hostforlifeasp.net is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft. Our service is ranked the highest top spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, we have also won several awards from reputable organizations in the hosting industry and the detail can be found on our official website.