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

Question

Question

Change to Background Colour when edited.

asked on March 11, 2019 Show version history

Hi All,

I have a form what populates two fields with identical data one is read only the other can be edited.

The below JavaScript works so only fields assigned the class "Name" are highlighted red when the data is changed. However when the form is submitted for review the background returns to white.

$(document).ready(function(){
  
 $('.Name input').on('keydown',function(){
      $(this).css('background','#ff4d4d');
 	});  
  $('.reset-highlight select').on('change',function(){
     $('.Name input').css('background','none');
  });
});

Any assistance would be appreciated

Thanks

Mark

0 0

Replies

replied on March 12, 2019

Hi Mark

Your Code runs each time the form is opened, the fact is, when the next person opens the document the field would only turn red if they clicked into the field and changed the field again.

You would need to come up with another method to track what field have changed and then use that to target the fields and change their color from what I can see.

For each of the fields, you would have an accompanying field which you would write a value into if the value changed and then test against that to change the color of your field.

Hopefully somebody else knows of a better way around this but that's the logic.

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

Sign in to reply to this post.