Generating A Bootstrap From JSON Using jQuery - Rachel

File Size: 3.5 KB
Views Total: 988
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Generating A Bootstrap From JSON Using jQuery - Rachel

Rachel is a lightweight jQuery plugin that provides an easy way to generate a Bootstrap 3 form from JSON data.

How to use it:

1. Download and include the jQuery rachel plugin on your Bootstrap page.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="js/rachel.js"></script>

2. Create a DIV container for the form.

<div class="container"></div>

3. Generate a login form inside the DIV container.

$(document).ready(function() {
  Rachel.title = "Login form";
  Rachel.generateForm(".container", [
      {
          "label": "Username",
          "id": "username",
          "type": "text",
          "placeholder": "Username"
      },
      {
          "label": "Password",
          "id": "password",
          "type": "password",
          "placeholder": "Password"
      },
      {
          "label": "Login",
          "id": "login",
          "type": "submit",
      }
  ], function() {
      // Events
      $("#login").on("click", function() {
          alert($("#username").val());
      });
  });
});

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