AnsweredAssumed Answered

Clear the managed metadata control using JavaScript

Question asked by riteshratna@gmail.com on Dec 19, 2017
Latest reply on Jan 9, 2018 by soni.tumu

I have a Managed Metadata Control that I want to clear whenever a checkbox is unchecked.

 

Managed Metadata control

 

Client ID JavaScript variable name for the checkbox is 'fldCheckBox'

Client ID JavaScript variable name for the Managed Metadata control is 'fldMetaData'

 

I am using the following code -

 NWF$(document).ready(function()
{  

      NWF$('#'+ fldCheckBox).change(function()
     {
          if(NWF$('#' + fldCheckBox).prop('checked') == false)
          {
               NWF$('#' + fldMetaData).val('');
          }
     });   

});

 

I am able to get into the change event and into the if block as well.

 

However the following statement is not making the desired effect.

NWF$('#' + fldMetaData).val('');

 

 

Could somebody please help me with a JavaScript to clear this metadata control, whenever the checkbox is unchecked.

 

I would appreciate any help extended to me.

 

Thanks.

Outcomes