Git Product home page Git Product logo

input-machinator's Introduction

input-machinator

input-machinator is a jQuery plugin for creating pretty input fields.

It creates styleable elements for check boxes, radio buttons and selects. All the other HTML input elements are reasonably styleable with CSS so we decided not to bother those.

An example is available in this source tree in the example folder.

How it works

The inputMachinator plugin creates a span element for every affected input element and hides the original input element. User interaction happens on the span elements and the input elements are updated accordingly.

How to use

You can use it like this:

$(selector).inputMachinator();

The plugin also automatically activates itself on document ready on every element with the machinator class. Please do NOT call the plugin on the same elements multiple times.

After calling the plugin on a set of elements, the site builder only has to create some CSS for the following:

  • span.machinator-checkbox - created for checkboxes
  • span.machinator-radio - created for radio buttons
  • span.machinator-select - created for selects
  • ul.machinator-select-dropdown - dropdown for selects, attached to the end of document body
  • the machinator-disabled class will be added to the spans for disabled elements

Things to note

If you change the value of the underlying input element programmatically, you will have to trigger the change event on them to update the pretty ones:

var $sel = $("input[checkbox].yourClass");
$sel.prop("checked", true);
$sel.trigger("change");

input-machinator's People

Contributors

aron123 avatar herflis avatar venemo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.