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
Post a Comment