Clone the things

Developer
Size
2,684 Kb
Views
32,384

How do I make an clone the things?

What is a clone the things? How do you make a clone the things? This script and codes were developed by UX Snippets on 27 October 2022, Thursday.

Clone the things Previews

Clone the things - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Clone the things</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="row-group" class="contact-group-01"> <div id="contactDL_0" class="row form-row"> <div class="form-inline"> <div class="form-group has-feedback gutter"> <input type="input" class="form-control" placeholder="Lookup Name"> <i class="fa fa-search form-control-feedback"></i> </div> <div class="form-group gutter"> <input type="input" class="form-control" placeholder="[email protected]"> </div> <div class="form-group gutter"> <select class="form-control" id="selectDL_0"> <option value="Role">Contract Representative</option> </select> </div> <div class="form-group gutter"> <button type="button" class="btn btn-default remove">&times;</button></div>	<button id="btn-name" class="btn btn-primary clone">Add</button> </div> </div>
</div>
<div id="row-group" class="contact-group-02"> <div id="contactAFKL_0" class="row form-row"> <div class="form-inline"> <div class="form-group has-feedback gutter"> <input type="input" class="form-control" placeholder="Lookup Name"> <i class="fa fa-search form-control-feedback"></i> </div> <div class="form-group gutter"> <input type="input" class="form-control" placeholder="[email protected]"> </div> <div class="form-group gutter"> <select class="form-control" id="selectDL_0"> <option value="Role">Contract Representative</option> </select> </div> <div class="form-group gutter"> <button type="button" class="btn btn-default remove">&times;</button></div>	<button id="btn-name" class="btn btn-primary clone2">Add</button> </div> </div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Clone the things - Script Codes CSS Codes

.form-control { font-size: 13px;
}
#row-group { margin: 50px;
}
#row-group .form-group { margin: 5px;
}
.clone, .clone2 { display: none;
}
.contact-group-01 > div:last-of-type .clone, .contact-group-02 > div:last-of-type .clone2 { display: block;
}

Clone the things - Script Codes JS Codes

var regex = /^(.+?)(\d+)$/i;
var cloneIndex = $(".contact-group-01 .form-row").length;
function clone(){	$(this).parents(".form-row").clone()	.appendTo(".contact-group-01") .attr("id", "contactDL_" + cloneIndex)	.find("*")	.each(function() {	var id = this.id || "";	var match = id.match(regex) || [];	if (match.length == 3) {	this.id = match[1] + (cloneIndex);	}	})	.on('click', 'button.clone', clone)	.on('click', 'button.remove', remove)	.val('');	cloneIndex++;
}
function remove(){	$(this).parents(".form-row").remove();
}
$("button.clone").on("click", clone);
$("button.remove").on("click", remove);
function clone2(){	$(this).parents(".contact-group-02 .form-row").clone()	.appendTo(".contact-group-02") .attr("id", "contactAFKL_" + cloneIndex)	.find("*")	.each(function() {	var id = this.id || "";	var match = id.match(regex) || [];	if (match.length == 3) {	this.id = match[1] + (cloneIndex);	}	})	.on('click', 'button.clone2', clone2)	.on('click', 'button.remove2', remove2)	.val('');	cloneIndex++;
}
$("button.clone2").on("click", clone2);
Clone the things - Script Codes
Clone the things - Script Codes
Home Page Home
Developer UX Snippets
Username appirio-ux
Uploaded October 27, 2022
Rating 3
Size 2,684 Kb
Views 32,384
Do you need developer help for Clone the things?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

UX Snippets (appirio-ux) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!