jQuery Usage Notes

Some jQuery usage notes for useful/common stuff:

To run script when the browser reaches ready state:

$(document).ready(function(){
    //do stuff here
});

Detecting browser type, eg:

if ($.browser.webkit){
     alert( "this is webkit!" );
}

Valid values are webkit, opera, msie, mozila

See here.

Change attribute value of an element:

$('#elementId').attr('attributename', 'new attribute value');

More, see here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.