I have written a code for displaying the values entered in two input text boxes in jquery. How to check whether the text boxes are filled with values or not ? I have done with change function to display the values entered from the text input boxes to be displayed inside the html.I want to validate whether the input boxes is being filled with values in jquery. How to check that ? I have only checked when it is inputted with values.
Javscript:
<script type="text/javascript">
$(document).ready(function(){
$("input").change(function(){
var startDate = $("#start-date").val();
var endDate = $("#end-date").val();
$(".rentdate").html("Rental Date<span> From:"+startDate+" To:"+endDate);
});
});
</script>
html:
<input type="text" id="start-date" name="start" placeholder="Select Date" data-date-format="DD, MM d" class="input-sm form-control"/><span class="date-text date-depart"></span>
<input type="text" id="end-date" name="end" placeholder="Select Date" data-date-format="DD, MM d" class="input-sm form-control"/><span class="date-text date-return"></span>