javascript - Hide and show div in a form using java script -


this question has answer here:

i have 2 fields in form, first field drop down menu shown below. second date picker.

<div class="form-group"> <label for="customername" class="col-sm-3 control-label">requires fpc? :</label> <div class="col-sm-7"> <select class="col-sm-12 form-control" id="fpc" name="fpc" required> <option value="yes">yes</option> <option value="no">no</option> </select> </div> </div>  <div class="form-group"> <label for="internal_ship_date_label" class="col-sm-3 control-label" id="internal_ship_date_label" name="internal_ship_date_label">internal ship date:</label> <div class="col-sm-7"> <input type="date" class="form-control" id="internal_ship_date" name="internal_ship_date"> </div> </div>  

when user selects option value "no" internal_ship_date hide. if user selects "yes", internal_ship_date show. in javascript trying learn! appreciated!!

you can this:

document.getelementbyid("internal_ship_date_label").style.display = ""; //to show document.getelementbyid("internal_ship_date_label").style.display = "none"; //to hide 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -