jQuery clone() Method
The clone() method is an inbuilt method in jQuery that is used to make a copy of selected elements including its child nodes, text, and attributes.
Parameters: This method accepts an optional parameter that could be either true or false specifying whether the event handler should be copied or not.
Return Value: It returns the cloned elements for the selected element.
Example 1: In this example, the clone() method does not contain any parameters.
Example 2: In the below code, true is passed to the clone method.
In this example, the code event handler animate will work when you click on the “GeeksforGeeks” and this will also reflect on the cloned elements.
My Personal Notes arrow_drop_up
Please Login to comment...