Tuesday 5 February 2013

Checkbox change event in SharePoint list forms using Jquery


<script>
 function handleEvents()
    {

          //Call the function in page load
          Check();

            $("input[title$='CheckBoxFieldName']").change(function(){
             //Call the function in change event
Check();
    });
    }

function Check()
{
      if($("input[title$='CheckBoxFieldName']").is(':checked'))
{
$("nobr:contains('FieldName ToHide')").parent('h3').parent('td').parent('tr').show();
$("h3.ms-standardheader:contains('FieldName ToHide')").closest("tr").show();

}
else
{
$("nobr:contains('FieldName ToHide')").parent('h3').parent('td').parent('tr').hide();

}


}
_spBodyOnLoadFunctionNames.push("handleEvents");
</script>

1 comment: