Minimal jQuery Validation Plugin For Empty Input Fields - denetmen.js

File Size: 6.42 KB
Views Total: 1460
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Minimal jQuery Validation Plugin For Empty Input Fields - denetmen.js

denetmen.js is a minimal jQuery form validation plugin which checks if text fields are empty with custom alert messages and optional lightbox integration.

How to use it:

1. Download and place the main JavaScript file denetmen.js after jQuery library, just before the closing body tag.

<script src="//code.jquery.com/jquery-3.1.0.slim.min.js"></script>
<script src="src/denetmen.js"></script>

2. Use the data-denetmen attribute to specify the custom error message when the input field is empty before submitting.

<input type="text" name="name" data-denetmen="Please enter a name!" placeholder="Name...">

3. Call the plugin on the html form and we're done.

$("form").denetmen();

4. Integrate with the Bootstrap modal (Requires Bootstrap framework).

$("form").denetmen({
  modal: {
    title: "Oppss!",
    button: "Okey",
    buttonClass: "success",
    fade: true
  }
});

5. More configuration options.

$("form").denetmen({

  // target text field
  item: "denetmen",

  // default alert message
  default: "Not entered value!",

  // highlights the invalid field
  highlight: true,

});

Change log:

2016-10-05

  • update denetmen.js

This awesome jQuery plugin is developed by izniburak. For more Advanced Usages, please check the demo page or visit the official website.