Pages

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');
}
}
);
 

2 comments:

  1. I need to hide a field on a main form when a specific value is not in a column in a related subview webpart. How do I go about this?

    ReplyDelete
    Replies
    1. Hi unknown

      To accomplish same requirement with jquery a little bit complex , would you please let me know some more in detail?

      Thank You!
      Disha Shah

      Delete