Here is a small example with the masked input plugin :
//apply the mask to an input
$('.st').live('click', function() {
$(this).mask("99:99");
});
.st
is a text input with a td, the use can clone the td. However, when you clone this td, and try to click in the .st
of the new element, your gain the focus of 开发者_如何转开发the first .st
and it's not working.
I have tried several things, bind()
, live()
, and each()
with no results.
New jQuery (since 1.3 or 1.4) can clone everything together with event bindings. See .clone() in documentation (supply true as a parameter)
You can always write a function binding everything to given elements and take care of it yourself.
Why not use $('your_selector').clone(true).appendTo('another_selector').focus()
?
精彩评论