Skip to content
sets/gets form input values using JSON documents
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


jquery-inputs plugin

jquery-inputs is a jQuery plugin that allows set/get on form inputs using hierarchical JSON structures

Form Element Names

Supports various naming conventions, e.g., demo_field_key, demo.field[key], and demo[field].key will all be treated as synonymous references to the same value.

Empty brackets will automatically generate a 0-based index.


Include jQuery and the plugin:

<script src="jquery.inputs.js"></script>

Create a demo form:

<form id="demo-form">

    <input type="text" name="demo_text" value="textval" />

    <textarea name="demo_textarea">textareaval</textarea>

    <select name="demo_select" multiple="multiple">
        <option value="option_a" selected="selected">Option A</option>
        <option value="option_b" selected="selected">Option B</option>

    <label><input type="radio" name="demo_radio" value="1" />1</label>
    <label><input type="radio" name="" value="2" />2</label>

    <label><input type="checkbox" name="demo_checkbox" value="1" checked="checked" />1</label>
    <label><input type="checkbox" name="demo[checkbox]" value="2" checked="checked" />2</label>


Set/get values via javascript:

  jQuery(document).ready(function($) {

    $('#demo-form').inputs('set', {
        demo: {
            text: 'text',
            textarea: 'text',
            radio: 2,
            checkbox: 2, // [1,2]
            select: ['option_a', 'option_b']

    console.log( $('#demo-form').inputs('get') );


See QUnit tests for further examples.


Denny Shimkoski


MIT License

Copyright (c) 2011, Denny Shimkoski (denny.webdev -[at]- gmail -[dot]- com)

Something went wrong with that request. Please try again.