AnsweredAssumed Answered

Change single textbox value using javascript

Question asked by david.neri on Aug 4, 2016
Latest reply on Jul 15, 2017 by nps9

Hi all,

 

I'm having some issues to clear a textbox based on my checkbox state

 

 

basic form.png

 

checkbox css class = check

textbox css class = textBox

 

I first started with the following code to hide the field

 

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

  NWF$('.check').click(function() {

  NWF$('.textBox').toggle('hide');

  });

});

 

Not a good idea since I can do this with rules but if I try to clear the text with a similar code it doesn't seem to work

 

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

  NWF$('.check').click(function() {

  NWF$('.textBox').value = " my text"; OR NWF$('.textBox').val("my text");

  });

});

 

Does anyone knows what am I missing ?

 

Thanks for your help

Outcomes