Saturday, February 12, 2011

Loading image using javascript

document.getElementById('divid').innerHTML = '<img src="imagepath" alt="Loading">';

How to use:

Before loading the content to div we have to use the above code with same divid

After that load your content to same div using innerHTML. We can't identify this image in localhost because it is fastly switched to content but in server we can see this image

Saturday, January 29, 2011

disable form element using jquery

Using Id:

jQuery('#id').attr('disabled','disabled'); //Here id is form element id
//Enable the form element
jQuery('#id').removeAttr("disabled");

Using Name:

jQuery('input[name="elementname"]').attr('disabled','disabled'); //Here element name is form element name
//Enable the form element
jQuery('input[name="elementname"]').removeAttr('disabled');

Saturday, January 22, 2011

get the text box value using jquery

By using textboxid:
jQuery('#texboxid').val();

By using name:
jQuery('input[name="textboxname"]').val();