As the jQuery instance is from the parent window, you have to specify
that you want an element from the iframe:

$ = window.parent.$;
$(function() {
$("#test", frames['thisframe']).click(function() { // element in
iframe
   $("#hold").append('<a href="#">Inserted from iFrame</a> <br />'); //
element in parent frame
   });
});

- ricardo

On Sep 24, 2:38 am, hubbs <[EMAIL PROTECTED]> wrote:
> I have a frame that I want to use the same instance of jquery as in
> the parent window. Here is what I did:
>
> $ = window.parent.$;
> $(function() {
> $("#test").click(function() {
>    $("#hold").append('<a href="#">Inserted from iFrame</a> <br />');
>    });
>
> });
>
> For some reason, the click event is not being bound, and the html is
> not getting appended.  BUT, if I remove the click function, and just
> load the page without it, it DOES correctly get inserted into the
> parent.  What is going on here?  And why can't I get a click function
> to work in a frame using the parents jquery instance?
>
> Example:http://web2.puc.edu/PUC/files/bind.html

Reply via email to