jQuery Plugin For Handling Conditional Html Elements - Conditional

File Size: 5.39 KB
Views Total: 1002
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery Plugin For Handling Conditional Html Elements - Conditional

Conditional is a very small jQuery plugin for handling conditional Html elements that allows to show and hide html elements conditionally based on user input.

See also:

Basic usage:

1. Assume that you have a select element that allows you to show specified html elements depending on the selected option.

<select name="languages" id="languages" data-conditional="languages">
  <option value="JavaScript">JavaScript</option>
  <option value="Html">Html</option>

2. Add conditional form elements to your webpage as follow.

<div class="hide conditional-logic" data-condition="languages" data-match="JavaScript">
<div class="hide conditional-logic" data-condition="languages" data-match="Html">

3. Include jQuery library and the jQuery Conditional plugin on the html page.

<script src="jquery.min.js"></script>
<script src="jquery.conditional.js"></script>

4. That's it. Override the default settings as shown below.

className: 'hide',
eventName: 'change',
onActivate: function(element, opts) {
onDeactivate: function(elements, opts, callback) {
autoBind: true

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