jQuery의 clone
기능은 다음과 같습니다이벤트 핸들러가 아닌 데이터를 복사하여 노드를 복제하는 방법은 무엇입니까?
.clone([withDataAndEvents ] [, deepWithDataAndEvents ])
withDataAndEvents: A Boolean indicating whether event handlers and data should be copied along with the elements.
deepWithDataAndEvents: A Boolean indicating whether event handlers and data for all children of the cloned element should be copied.
이러한 매개 변수 모두 data
및events
에 영향을 미친다. 데이터 만 유지할 수는 있지만 이벤트는 유지할 수 없습니까? 기본적으로, 나의 이상적인 clone
기능은 다음과 같을 것이다 :이 acheive 수있는 방법이
.idealClone([withData] [, withEvents ] [, deepWithData ] [, deepWithEvents ])
withData: A Boolean indicating whether data should be copied along with the elements.
withEvents: A Boolean indicating whether event handlers should be copied along with the elements.
deepWithData: A Boolean indicating whether data for all children of the cloned element should be copied.
deepWithEvents: A Boolean indicating whether event handlers for all children of the cloned element should be copied.
있습니까?
NB 나는 1.8.1와 함께 일하고 있어요,하지만 모든 버전에 대한 대답은 쉽게 당신의 이상적인 복제 방법으로 jQuery 오브젝트를 확장 만 유지 data
및 off
의 다양한 조합을 사용할 수 있습니다
방금'클론()'와'언 바인드()'를 사용할 수 없습니다 : 개인적으로 나는 그냥 할 정도로 쉽게 생각? – BenM