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

Question

Question

Search for value of a date field

asked on June 5, 2018

So, by default, I'm showing the Reject button but hiding the Approve button. If the value of .dateLRApproval is empty/null, then status quo! However, if the value of .dateLRApproval is filled in with a date, I want the Reject button to hide and the Approve button to show.

$(document).ready(function(){

//hide buttons
  $('.Approve').hide();

//Show Approve button when there's an LR Approval Date
  if ($('.dateLRApproval').val() != '') {
    $('.Reject').hide()
    $('.Approve').show();
  }

});  //close document.ready

I'm sure it's something silly ... can someone please tell me what I'm doing wrong? I've spent too much time on this already. Thanks!

0 0

Answer

SELECTED ANSWER
replied on June 5, 2018 Show version history

Very close, looks like you are not targeting the input, just need to add it to your selector.

 

  if ($('.dateLRApproval input').val() != '') {
    $('.Reject').hide();
    $('.Approve').show();
  }

 

0 0

Replies

replied on June 5, 2018

Pretty sure I tried that (but I tried MANY things). Thank you, it worked! Appreciate the quick response.

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

Sign in to reply to this post.