How to Validate Empty Field in Javascript

Using javascript we can validate the data before sending to server. In this tutorial i’ll show you how to validate empty field in javascript. To demostrate this let’s first create one form.

Javascript Objective Interview Questions

I have created one form in which there is one textarea and submit button. When user click on submit button, first we check whether user has input any value in textarea. If the value of textarea is empty we alert message and return false otherwise form will be submitted successfully.

How to Validate Empty Field in Javascript

When user click on submit, on the click of submit we call validate_empty_field() function, let’s define this function.

Similarly you can field any input field using javascript.

Tagged , . Bookmark the permalink.

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.