How to Hide or show List or Library control

Hi I would like to show/hide fields based on toggle.

the below code i tried is working if its text field but not for list and library control.

SPDataTable3 is the table i would like to hide

function hideOrShow() {

  if (fd.field('ProfessionalIndemnityInsurance').value) {
   } else {
       $(fd.container('SPDataTable3').$parent.$el).hide(); ; 

fd.field('insuranceclaimslevied').$on('change', hideOrShow);
fd.field('ProfessionalIndemnityInsurance').$on('change', hideOrShow);

Hello @Rinu,

To hide/show List or Library control dynamically you need to:

  1. Give control a CSS class, e.g. 'table-to-hide'
  2. And use this code to show/hide the control:
//hide control
//show control

Please find more information about how to work with fields/control/containers in JavaScript here.

Thank you Mnikitina, was it the same for any controls such as RichText etc

Dear @Rinu,
Yes, you can use the following method for anything on the form. Moreover, you can give the same class to a number of cells, and hide multiple at the same time, like a group.