Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jquery-unique-clone

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery-unique-clone

Like `$(element).clone()` but with unique IDs

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

jQuery Unique Clone

Like $(element).clone() but will ensure that each ID in the cloned element is unique.

Useage

With given HTML:

<div class="container">
  <label for="foobar">Foo Bar</label>
  <input type="text" id="foobar">
</div>

This JavaScript:

$('.container').uniqueClone();

Will return a jQuery collection representing:

<div class="container">
  <label for="foobar-clone">Foo Bar</label>
  <input type="text" id="foobar-clone">
</div>

Options

This plugin's API mimics the core clone method.

paramtypedefault valuedescription
withDataAndEventsBooleanfalseindicates whether event handlers should be copied along with the elements.
deepWithDataAndEventsBooleanvalue of withDataAndEventsindicates whether event handlers and data for all children of the cloned element should be copied. By default it's value matches the first argument's value, which defaults to false.
suffixString-clonethe string to be appended to the end of the ID or FOR attribute value.

Examples

$(element).uniqueClone();
$(element).uniqueClone(true);
$(element).uniqueClone(true, false, '-in-dialog')

Running Tests

git clone git@github.com:meowsus/jquery-unique-clone.git
cd jquery-unique-clone
npm install
gulp mocha

Keywords

FAQs

Package last updated on 06 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc