[jQuery] Re: Inner HTML on a .bind()
Try this: $('object').click(function(){ $(this).find('embed').css({width:500px,height:500px}); }); 2009/6/4 AndyW awyso...@absoftware.com My page basically puts in a few YouTube videos on my page object class=YTV ...param .../paramparam .../paramembed height= width=.../embed/object object class=YTV ...param .../paramparam .../paramembed height= width=.../embed/object object class=YTV ...param .../paramparam .../paramembed height= width=.../embed/object In my document ready function I do the following $(object.YTV *).bind('click', function(e){ alert( $(this).html() ); /* this show the HTML code within the OBJECT tag */ var emb1 = $(this).contains(embed).html(); var emb2 = $(embed, this).html(); alert( emb1 ); alert( emb2 ); }); My end goal is to change the width and height of the EMBED ... tag like they do on FaceBook where when you click on a video, the video display gets bigger. Since there are a few of these objects on the page. How in my bind (click) code do I figure out and update the EMBED tag that is contained within the OBJECT tag. If I set the EMBED tag with a unique ID= I can update it, but for the life of me I'm missing how to parse out the inter HTML code that is within the OBJECT tag that I can see in my $(this).html() ? Thanks Andy -- Gustavo Salome Silva
[jQuery] Re: Inner HTML on a .bind()
Actually I finally got it to work using, the part I was missing was I had to pass in 'this' witht he search otherwise - I'm guessing here - it was using the document instead of just the section I wanted it to search. This gives me the feature that FaceBook has of making the imbed videos bigger when clicked on. YAY Gustavo, I couldn't get the CSS working since the width and height were part of the tag and not the style= section $(document).ready(function(){ $(object.YTV).unbind( 'click' ); $(object.YTV).bind('click', function(e){ $(this).attr(height, 312); $(this).attr(width, 384); $(embed, this).attr(height, 312); $(embed, this).attr(width, 384); $(this).unbind( 'click' ); }); });