Wednesday, March 16, 2011

JQuery with a small example

Hello friends
I was just trying to use JQuery with SharePoint sites and here is the very basic example which toggles button.

Notes:  In JQuery, we can refer object with its ID by using #. ".toggle()" this function is already available inside the JQuery , so we just have to name it which saves time

Example:
$('#exapandButton').click(function()
{
$('#warning').toggle();
if ($('#warning').is(':visible'))
{
$(this).val('Hide');
}
else
{
$(this).val('Show');
}
}
);