npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cform

v1.2.6

Published

jQuery cForm replaces your standard, ugly form-elements with nice and clean non-form html code which can be styled via CSS.

Downloads

21

Readme

jquery.cForm

jQuery cForm replaces your in many cases unstylable form-elements (input, select, radio, checkbox, file, button, textarea) with nice and clean non-form html code which can be styled via CSS. The original elements are retained (just hidden), so you won´t loose any form-element related functionality. You can add custom HTML templates for all supported form elements and use CSS to style them. Or you just use the default templates and style them with the included CSS or SCSS file.

####Demo

Feedback

Please give me feedback to make cForm better: Either as github-issue, or to [email protected]

Usage

1. Include script

Add jquery.cform.js or jquery.cform.min.js in your html file

2. Include styles

Add cform.style.css or cform.style.min.css in your html file This will add basic styling for the generated elements.

3. Call cForm

Call cForm inside of your $(document).ready() function. You can either call it on elements which contain multiple form-elements (which will than work on every of this element) or on a form-element directly (which will just style this element).

$('.element').cForm();

4. Enjoy!

Plugin options

$('.element').cForm({
  templates: { 
    text:        'html-template',
    textarea:    'html-template',
    password:    'html-template',
    file:        'html-template',
    checkbox:    'html-template',
    radio:       'html-template',
    select:      'html-template',
    multiselect: 'html-template',
    option:      'html-template',
    button:      'html-template',
    submit:      'html-template',
  }
});

In case of text, password and textarea, the given template will just be wraped around the input.

All other templates have to include data-name="{{name}}" and data-value="{{value}}" in the outermost element.

select templates also have to contain the placeholder {{text}}, which indicates the position the current selected value will be shown. select and options templates contain a placeholder {{class}}, which will add a class selected to the by default selected option.

(to see how the default templates look, scroll to the end of the readme file)

##Additional Information

The original form-element won´t be removed from the DOM. It will just be hidden. Changing the value of the cForm element (by user interaction) will also change the connected (and hidden) form-element.

If you want to change a form-value by JavaScript, change the value of the original element and use the jQuery function .trigger('change') on the changed element: the connected cForm element will than be updated automatically.

Calling updateAttributes on a cForm-Select field will check the original select field for changed attributes (e.g. disabled) and update them on the cForm-Select.

Additionaly there is a cFormChanged Event which will be fired when a cForm-Element was changed.

List of default templates

input type="text"
<div class="cform-text"></div>

input type="password" // password
<div class="cform-text cform-password"></div>

textarea // textarea
<div class="cform-text"></div>

input type="file" // file
<div class="cform-file" data-name="{{name}}">
  <div class="cform-control">choose file</div>
  <div class="cform-filename"> click here</div>
</div>

input type="checkbox" // checkbox
<div class="cform-checkbox" data-name="{{name}}" data-value="{{value}}">
  <div class="cform-marker"></div>
</div>

input type="radio" // radio
<div class="cform-radio" data-name="{{name}}" data-value="{{value}}">
  <div class="cform-marker"></div>
</div>

select // select
<div class="cform-select {{class}}" data-name="{{name}}">
  <div class="cform-control">{{text}}</div>
  <ul></ul>
</div>

select multiple // multiselect
<div class="cform-multiselect {{class}}" data-name="{{name}}">
  <ul></ul>
</div>

select option // option
<li data-value="{{value}}" class="{{class}}">{{text}}</li>

button // button
<div class="cform-button"></div>

input type="submit" // submit
<div class="cform-submit"></div>