Disabling field using JavaScript doesn't work

  • 27 April 2020
  • 2 replies
  • 42 views

Badge +2

Hi, 

 

I have a field that I want to disable using JavaScript (meaning that the user can't click on the checkbox)

 

7616i6954D0C868524124.png

I tried using this

NWF$("#" + varIT).attr("disabled", true);

or this

NWF$("#" + varIT).prop("readonly", true);

but both didn't work.

 

What am I doing wrong?

 

 


2 replies

Badge +8

Hi,

 

not a jquery pro so there might be a better solution, but this works for me:

NWF$("#" + varIT + " input[type=radio]").attr("disabled", "disabled")

I noticed the whole "Choice" control is rendered as an html table containing radio inputs, so I disabled them after noticing that disabling the table didn´t do the trick

Badge +2

Hi Tarf :)

 

sorry for the late reply.

I just tried it out and it works!

 

Thanks once again for your help!

Reply