All Projects → tristandenyer → Clone Section Of Form Es6 Or Jquery

tristandenyer / Clone Section Of Form Es6 Or Jquery

Licence: mit
Now on npm. Using vanilla JavaScript (ES6) or jQuery to duplicate a section of a form, maintaining accessibility (a11y).

Programming Languages

javascript
184084 projects - #8 most used programming language
es6
455 projects

Projects that are alternatives of or similar to Clone Section Of Form Es6 Or Jquery

Footer Reveal
A jQuery plugin for easy implementation of the 'fixed/reveal' footer effect. Demo here:
Stars: ✭ 111 (-0.89%)
Mutual labels:  demo, jquery
Survey Library
JavaScript Survey and Form Library
Stars: ✭ 3,060 (+2632.14%)
Mutual labels:  forms, jquery
Jcf
Advanced form elements customization using CSS/JS
Stars: ✭ 203 (+81.25%)
Mutual labels:  forms, jquery
Evolutility Ui Jquery
Model-driven Web UI for CRUD using REST or localStorage.
Stars: ✭ 164 (+46.43%)
Mutual labels:  forms, jquery
Form2js
Javascript library for collecting form data
Stars: ✭ 630 (+462.5%)
Mutual labels:  forms, jquery
Ziptastic Jquery Plugin
This is a jQuery plugin that shows how Ziptastic could be used.
Stars: ✭ 244 (+117.86%)
Mutual labels:  forms, jquery
Spring Boot Enterprise Application Development
Spring Boot Enterprise Application Development.《Spring Boot 企业级应用开发实战》
Stars: ✭ 261 (+133.04%)
Mutual labels:  jquery, bootstrap-4
Timer.jquery
jQuery Timer: Start/Stop/Resume/Remove pretty timer inside any HTML element.
Stars: ✭ 283 (+152.68%)
Mutual labels:  demo, jquery
Vvvebjs
Drag and drop website builder javascript library.
Stars: ✭ 4,609 (+4015.18%)
Mutual labels:  jquery, bootstrap-4
Jquery.scrollto
Lightweight, cross-browser and highly customizable animated scrolling with jQuery
Stars: ✭ 3,609 (+3122.32%)
Mutual labels:  demo, jquery
Tableexport
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
Stars: ✭ 781 (+597.32%)
Mutual labels:  demo, jquery
Hideshowpassword
Because life's too short to waste time re-typing passwords.
Stars: ✭ 734 (+555.36%)
Mutual labels:  forms, jquery
Uploader
A lightweight and very configurable jQuery plugin for file uploading using ajax(a sync); includes support for queues, progress tracking and drag and drop.
Stars: ✭ 1,042 (+830.36%)
Mutual labels:  forms, jquery
Wechatappdemo
微信小程序demo,微信小程序开发教程,小程序快速入门,新版SDK DEMO请查看
Stars: ✭ 110 (-1.79%)
Mutual labels:  demo
Cameraxdemo
A sample camera app with CameraX API from Android Jetpack
Stars: ✭ 112 (+0%)
Mutual labels:  demo
Hooked Form
Performant 2KB React library to manage your forms
Stars: ✭ 110 (-1.79%)
Mutual labels:  forms
Fileuploader
Beautiful and powerful HTML file uploading tool. A jQuery, PHP and Node.js plugin that transforms the standard input into a revolutionary and fancy field on your page.
Stars: ✭ 111 (-0.89%)
Mutual labels:  jquery
Flutter crop
Crop any widget/image in Android, iOS, Web and Desktop with fancy and customizable UI, in pure Dart code.
Stars: ✭ 107 (-4.46%)
Mutual labels:  demo
Demos
DragonBones Demos (Art assets only)
Stars: ✭ 109 (-2.68%)
Mutual labels:  demo
Goalprogress
💯 Animated progress bar using jQuery to show how close you are to reaching your goal.
Stars: ✭ 109 (-2.68%)
Mutual labels:  jquery

npm

Plain JavaScript version now available on npm! (Currently in alpha.)

Duplicate a section of a form, maintaining accessibility (a11y)

Using jQuery or plain JavaScript (ES6), you can now duplicate a section of a form (as well as destroy the last cloned section), the whole form, or just one or two inputs. This also allows the user to add an empty form section with unique, iterative ID, for, name, and label to maintain accessibility (a11y) and work with the database.

To help you get a jumpstart on this, the .js files are well-commented.

Overview

A more detailed overview can be found here. I will be working on porting it over to this page soon. (Still working on this todo.)

jQuery version

The jQuery version has been in development since June 2013, and is more stable, at the moment.

ES6 JavaScript version

The ES6 version was a direct port over from the jQuery version. While it works in the same way the jQuery one does, there are some notable todos and refactoring that needs to be done before it can be used in production environments.

Capabilities

This cloning script is built to:

  • allow a user to duplicate a section (one or more inputs) of a form
  • not duplicate the user’s inputs from the original section, but show a fresh, empty section below the original
  • stop a user from adding new sections at a specified integer (default is 5 total)
  • maintain the accessibility of matching the labels to the input attributes, even after cloning
  • increment the updated for, id and name attributes (ID2_, ID3_, ID4_) so as to be unique pairs
  • be customizable to work with your existing form

This is not a drop-in-and-it-works solution. You can see in the .js files that we depend on querying for classnames to update the for, id and name attributes of inputs, among other things.

How it works

  1. you wrap the section you want to allow to be cloned with a div with a class of clonedInput.
  2. on click, we clone that section and all of its children nodes
  3. then we increment a number variable (to keep track of sections; for, id and name attributes; removing sections...)
  4. increment the for, id and name attributes (ID2_, ID3_, ID4_) of inputs
  5. set all input values to null
  6. insert the cloned and updated section after the previous
  7. check if we are at the max allowable sections, and update buttons accordingly

Demos

The ES6 demo can be viewed here (download repo and view).

Duplicate a whole section of a form

The Bootstrap 3.4 demo for duplicating a whole section of a form can be found here.

Duplicate multiple elements independently

The Bootstrap 3.4 demo supporting duplicating multiple elements independently can be found here.

Cool Time Budget Calculator on Codepen

I found a pen that uses version 0.9.4.1 to create a simple form for a calculator. View it here.

Questions/support

You can best reach me by using my contact page.

Or on Twitter: @tristandenyer

License

The MIT License (MIT)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].