[jQuery] Weird thickbox/Jquery failure.
OK, Ive got a form with some links that trigger thickbox windows. This
is the short version:
<form id="reply">
<a href="#TB_inline?
height=175&width=305&inlineId=linkerBox&modal=true" class="thickbox">
<img src="/media/img/icons/fam/link.png" title="Insert Link"
alt="Link" />
</a>
<span id="linkerBox" class="formatHelper">
<label for="url">Link URL:</label>
<input type="text" id="url" />
<label for="linktext">Text to display:</label>
<input type="text" id="linktext" />
<button id="linkercloser"
onclick="linkerclose(this);tb_remove();">OK</button>
</span>
<textarea name="post_text" id="id_text"></textarea>
</form>
Under normal circumstances, this works fine.
However, I've got links in the page to move the form around within the
page, bringing it near the post the user is attempting to reply to:
$("div.postcontrols").find("a.reply").each(function(i){
$(this).click(function(e) {
e.preventDefault();
theParent =
this.parentNode.parentNode.parentNode.parentNode;
if (theParent.lastChild.nodeName != "FORM") {
$(form).remove();
$(theParent).append($(form));
$(id_text).focus();
$.highlightFade.defaults.speed = 3000;
$(form).animate({height: 'show'}, 'slow');
$(form).highlightFade('paleyellow');
}
});
});
This also works fine. The problem is, if someone moves the form
(calling the above function), the thickbox links stop working. There's
no error generated. They just do nothing.
Suggestions?