Category » jQuery

JSON – An Overview

JSON

JSON stands for JavaScript Object Notation. It is a format for storing and exchanging data. It is based on a subset of the JavaScript Programming Language.

The file type for JSON files is “.json” and MIME type for JSON text is “application/json“.

Here are the characteristics of JSON:

  1. It is a lightweight data-interchange format.
  2. It is easy for humans to understand.
  3. It uses Javascript format but it is a text which makes it is completly language independent as text can be read and parsed by any programmng language.

Continue reading »

How to limit the number of characters that can be entered in a textarea or input field?

Edit Text

In web pages which take input/feedback from the customers it’s a good idea to limit the type and size of data that can be entered so that spam can be avoided.

Let see how we can limit the number of characters that can be entered in a text box.

The simplest approach I follow is to use the jQuery “Limit” plugin. Click here to download the plugin.

Continue reading »

How to Add Smooth Page Scroll to Top using jQuery

Scroll to Top

You would have come across websites that provide an easy way to scroll to the top of the webpage as you move down the page, its really a good idea if the webpage is long and you want to provide a better user experience. In this article, we will show you how to add a smooth scroll to top effect using jQuery.

We will create a button on the footer of the page which when clicked will scroll the page to the top smoothly, we will use css to postion the button at a fixed position on the bottom right of the page and jQuery to provide the scrolling effect and make the button visible only if the page is scrolled down, instead of being always visible.

Step 1: Add button link
Place the following code just before the closing </body> HMTL tag

<a href="#" id="scrolltotop" title="Back to top">Back to top</a>

Continue reading »

IE7 issues with jQuery removeAttr method

I had used jQuery('#id').attr('readOnly', 'readOnly') set the readonly property of text box and used jQuery('#id').removeAttr('readOnly') to make the text box again but then found that "removeAttr" did not work in IE7, the textbox was still not editable.

Continue reading »

Back to top