<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" > < html> . Clone(True). InsertAfter (this); } ); </script> Clone me!</button> </body>
(1) In this example, clone , clone (True) the difference is that Clone (ture), in addition to cloning a collection, also clones the click Handle
(2): clone Clone me! cannot continue clicking Clone. But clone (true) comes out of Clone me! You can continue cloning, no difference from the original button.
As is the experience of Iteye, I really have a deep feeling today. Almost a lot of redundant code was written. The process is as follows:
<li class= "More_box" ></li> <li class= "Tab_more" > <div id= "more_list" > <a href= "#" ><b> performance appraisal </b></a> <a href= "#" ><b> Management review </b></a> <a href= "#" ><b> Job analysis </b></a> <a href= "#" ><b> system maintenance </b></a> <a href= "#" ><b> personal settings </b></a> </div> </li>
The effect that needs to be achieved is to clone a and add it to <li class= "More_box" ></li> after a click in Id= "More_list".
$ ("#more_list >a"). Click (function () { $ (". More_box"). HTML ($ (this) . Clone(True)). Show (). click (); })
The result is a clone, but the click event of the LI element itself does not work. (in the above principle, when clone(True), the Click event of a is also copied, so when Li clicks on the event that A's click is triggered, the original event is overwritten)
So I found the reason for an afternoon.
Remove clone(True) and true in (clone only the element, not clone the event).
$ ("#more_list >a"). Click (function () { $ (". More_box"). HTML ($ (this) . Clone()). Show (). click (); })
Everything is settled ~ ~