Column

how to check date field is empty in javascript. how to check date field is empty in JQuery. Check if an Input type=”date” is Empty in JavaScript

how to check date field is empty in javascript.

how to check date field is empty in JQuery.

Input Type date and want to check for empty

 

Follow the following steps.

Step1:

Set Id for the Field

<input type=”date” id=”FromDate” required class=”form-control” />

Step 2:

Create a button and Call a function on its click event as below.

<button onclick=”checkField()“></button>

Step 3:

Write a function in javascript to check the field

<script>

function checkField()

{
var fvalue = $(“#FromDate”).val();

if (fvalue == null || fvalue == null || fvalue == “” || fvalue == “”)
{
alert(“Field is empty”);
}

else

{

alert(“You have selected date:”+ fvalue );

}}</script>

 

 

 

Click to comment

Leave a Reply

Your email address will not be published.

Most Popular

To Top
%d bloggers like this: