javascript - In jsp, hiding a field based on other field that has datepicker -


i totally new jsp , situation, have 2 fields, f1 , f2. want hide f2 if there change done in f1.

f1 looks like:

<input type="text" class="form-control" id="f1-id" name="f1-id" data-date-format="yyyy-mm-dd"> 

i added code:

$("#f1-id").on('change', hidef2);  function hidef2() {   $("#f2-id").hide } 

f2 hides if use keyboard change f1, f2 not hiding @ if change f1 using mouse. remember f1 has date picker.

your code works me (just add parenthesis behind "hide"):

$("#f1-id").on("change", hidef2);    function hidef2() {      $("#f2-id").hide(); // add parenthesis here!  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>  <div class="col-xs-6">      <label>f1-id</label>      <input type="date" class="form-control" id="f1-id" name="f1-id" data-date-format="yyyy-mm-dd">      <label>f2-id</label>       <input type="date" class="form-control" id="f2-id" name="f1-id" data-date-format="yyyy-mm-dd">  <div>


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -