Most voted "clone" questions
A clone is an identical copy of an object with the same attributes, data, and methods, as if it were the original object.
Learn more…34 questions
Sort by count of
-
14
votes2
answers8665
viewsHow to clone an element in Javascript?
Is it possible to obtain an exact clone of a given HTML element? so that the clone contains all properties exactly the same? If there is, I would like to know how to proceed to perform this clone,…
-
12
votes3
answers1771
viewsWhat is the purpose of the magical __clone method?
In PHP we have the magic method __clone. It serves to define a behavior when you clone an object through the keyword clone. So far so good. But I did not understand very well why to have this…
-
7
votes3
answers566
viewsSame types but with different objects. What is the best way to use it?
I had to create a new object but totally the same as the one in the C#system. Since the objects are the same I tried to do: ObjetoOriginal.Propriedades = ObjetoClone.Propriedades; Unfortunately it…
-
6
votes1
answer2127
viewsHow to clone objects in Python?
In some languages, besides being able to instantiate a class to construct a given object, we can also clone an existing instance, if we want an object with the same characteristics of the current…
-
6
votes1
answer242
viewsAre cloned objects not equal when comparing to Object.equals()?
I was doing some equality tests, and when comparing two objects, being a clone of the other, I noticed that the equals returns false, even though the objects are identical. The return should not be…
-
5
votes1
answer92
views.clone() not registering Select value in cloned DIV
Good afternoon guys, I think it may be something really stupid, but I can’t identify why the clone that I make of my page to be able to print 2 ways, is not capturing SELECT value of my products, it…
-
5
votes1
answer4065
viewsPython, clone the lists
Be the code below: def modif1(lista): lista = [4,5,6] lista = [1,2,3] modif1(lista) print(lista) #resultado: [1,2,3] def modif2(lista): lista[0] = 4 lista[1] = 5 lista[2] = 6 lista = [1,2,3]…
-
5
votes2
answers213
viewsLike "clone" an Inputstream?
Often I need to read a InputStream more than once. For example, to pass on the content of stream for multiple methods. void readStream(InputStream input) throws Exception { var result1 =…
-
3
votes2
answers1985
viewsClone data insertion box from with jQuery
I wanted to make it work with js(jQuery) the interface below: I am using the CSS Foundation framework to develop this project. However, I don’t know how to make a clone using the jQuery of this…
-
3
votes1
answer1338
viewsHow to clone a javascript object? By copying and not by reference?
I need to copy a javascript object to be able to manipulate the copy freely. But when I try to copy the object normally through the sign =, the "copy" is performed by reference. That is, I actually…
-
3
votes1
answer125
viewsMemberwiseclone of aggregates
I have in memory (not yet stored in database) an object of type List<NotaFiscal>. I need to pass an item from this list as a parameter to a screen to make changes to that object. However it…
-
3
votes1
answer299
viewsPrinciples of Encapsulation
I am studying for the Java Programmer SE 7 I certification exam. I use Selftest Kaplan (recommended by Oracle itself). I came across the following question: (I will leave everything in English on…
-
3
votes3
answers422
viewsClone <select> jquery / javascript
Guys, I’m a beginner and I’m having a hard time running this code I used from another topic right here (Add and Remove Fields with Javascript). Here it did not run, but on my localhost it even…
-
3
votes2
answers37
viewsDoubt as to whether to exclude specific elements of the clone() function
I have a doubt about the exclusion of specific elements when I use the function clone(). I wonder if I can rule out the elements <b> when I call the function. That is, what is written "Item",…
-
2
votes1
answer97
viewsConexões Clonadas
I wonder if there is how to create only a connection to the database to perform the tasks. With each Action executed, a connection with the Database is created and at the end of the Action…
-
2
votes2
answers387
viewsHow to clone an object in javascript?
I want to pass an object per function parameter, but I don’t want that object to be changed. For this I want to pass a clone parameter. Because in javascript, by the tests I did, the object is…
-
2
votes1
answer56
viewsProblems with . clone() to radio Buttons
I’m making an "add" button that every click adds a div com Radio Buttons below the div itself. I have trouble clicking on the radios that when I click on of some added line and click on another line…
-
2
votes1
answer138
viewsHow does the cloneNode method work?
I am creating an application and need to copy an element to create it again in the HTML page. Searching the internet, I found the method cloneNode. I want to know the following: How the method…
-
2
votes1
answer34
viewsHow to create a copy of an element, through its property
I want clone only images whose the attribute alt be "photo". Code var str = document.getElementById('A'); var clone = str.cloneNode(true); document.getElementById('B').appendChild(clone); <span…
-
2
votes1
answer110
viewsInsert cloned items into the form with PHP and Mysql
Friends, I’m having trouble recording cloned Mysql fields in the form. I’ll try to explain in detail to see if my friends can help me. <div class="mb-md"> <a href="#" id="but_add"> <i…
-
1
votes1
answer112
viewsCloning a class
I am "trying" to clone the following class: public class CadHorario implements Serializable, Cloneable { private int cdHorario; ... private Date horarioInicio; private Date horarioFim; private…
-
1
votes0
answers162
viewsSelect2 does not work after cloning the entire Section
After cloning an entire Section, select with Select2 no longer works. I tried to use Destroy to use Select2 in JS but it doesn’t work. Can anyone help me? It would be of great value. Thank you. The…
-
1
votes1
answer64
viewsDIV clone from one page to another
Hello I’m having trouble copying the side menu of the home page to the category page, I usually use the command below to copy div to the same page, but for different pages I’m not getting <script…
-
1
votes1
answer188
viewsHow to clone a dynamically created element with jquery?
I need help cloning an already created element dynamically with Jquery and adding +1 in value and element name. else if(valorSelect == 'listaSuspensa'){…
-
1
votes0
answers76
viewsWhy does Bootstrap class have no effect on Cloned elements?
I have a problem where I have a product DIV and in the select of the product name, I have a selectpicker where I can search the name of the product among all existing. But when the user adds another…
-
0
votes0
answers33
viewsClone + autocomplete help
Good night. I’m using this example of autocomplete : https://jqueryui.com/autocomplete/ It works exactly as I need it... but the problem occurs when I clone this element. Then the autocomplete…
-
0
votes1
answer82
viewsOn the production server I use git as Fork or clone? what is the best structure for an active project?
my question is how best to use git on a production server. for example I have a project in git but I don’t know if it’s better to publish the project on the server via Fork via clone, if it’s nice…
-
0
votes1
answer137
viewsClone commit from a project on Github
Hello, everybody. So, I’m taking an angular course that has a project hosted on Github. But I don’t want to clone the project ready. I’d like to clone/download the commit with the initial project…
-
0
votes1
answer80
viewsWhen a 'cloned' struct is changed it changes all the others
I have the following statements: #define SCALE 4 #define PADDING 1.1 #define CUBES 27 #define CUBE_VERTICES 8 #define CUBE_FACES 6 #define FACE_VERTICES 4 typedef struct { float angle; float x;…
-
0
votes1
answer98
viewsHow to recover the functions of a cloned editor?
I’m dynamically adding the summernote down in green. I’m actually cloning the ones above. Of course I’d have a problem with that otherwise it wouldn’t be programming. The functions of the added…
-
0
votes1
answer893
viewsHow to clone from a Bitbucket repository using bash code and passing the password as a parameter?
I have a bash code that creates a server instance in AWS. The last step of this process is to clone the project that is in the bitbucket.org. Usually what I do manually are these steps: cd…
-
0
votes3
answers127
viewsCloning elements with Javascript
I am facing problems to clone elements with javascript. The problem: As shown below, the form contains a checkbox that when clicking executes a function that changes the input value Qtd Min. By…
-
0
votes0
answers38
viewsHow can I clone a record from a stored table using Procedure and picking up the fields dynamically?
I have the need to clone a record into a table but picking up the fields the way they are, the reason is that someone can insert or remove some column, so I don’t know which columns I have in the…
-
0
votes1
answer60
viewsI command Git to clone repository but it only clones the ". git" and ". gitignore" folders
I do the command to clone the code that’s in Github but Git only clones the ". git" and ". gitignore folder". Here is my repository: The project: (If I’m putting up too many pictures, excuse me...…