You are viewing limited content. For full access, please sign in.

Question

Question

Clear Value on Form Open

asked on May 2, 2017

I have two fields that need to be cleared when the form opens. I don't care if there's already data in those fields or not.

This is what I have at the beginning:

$(document).ready(function(){
//set fields to hidden or readonly
  $(".read-only *").prop("readonly", true);//make fields with read-only class read-only
  $('.docNumberingID').hide();
//Rename Auto Fill Button
  $('.autofill').text('Validate');
//Blank out all reviewer actions and comments
  $('.structuralAction input').val('');
  $('.structuralComments input').show();
  $('.structuralComments input').val('');
  $('.structuralComments input').hide();
});  //close document.ready

What am I doing wrong? Everything else above it works fine!

0 0

Answer

SELECTED ANSWER
replied on May 2, 2017

For the Structural Comments line, use this instread

$('.structuralComments textarea').val('');

 

1 0

Replies

replied on May 2, 2017

Try this. Wait about 4 seconds after the form loads and see if it clears it.

$(document).ready(function(){

setTimeout(function(){

  $(".structuralAction input").prop('checked', false);
  $('.structuralComments input').val('');

}, 4000);

});

 

0 0
replied on May 2, 2017

Worked great for structuralAction but not for structuralComments.

0 0
SELECTED ANSWER
replied on May 2, 2017

For the Structural Comments line, use this instread

$('.structuralComments textarea').val('');

 

1 0
replied on May 2, 2017

That worked!!! Thank you so much!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.