If you add the event handlers to the callback you can get it working:
$("#content").load(loadLink, function(){
hideLoader();
$('.details').hide();
$('.showDetails').click(function() {
$('.details').slideToggle('slow');
return false;
});
})
On Dec 21, 4:20 pm, suntrop <[email protected]> wrote:
> Sorry for that, but how can I bind the event after I call $
> ("#content").load(loadLink,"",hideLoader);?
>
> Do I have to replace hideLoader with a function that contains all the
> "new" code?
>
> Thanks for your help!
>
> On 21 Dez., 17:30, DumpsterDoggy <[email protected]> wrote:
>
> > You can't bind any events to the controls on $(document).ready() if
> > the html isn't there. I would try binding the event after you call $
> > ("#content").load(loadLink,"",hideLoader);
>
> > On Dec 21, 10:17 am, suntrop <[email protected]> wrote:
>
> > > Hi there.
>
> > > I am loading some content into my page …
>
> > > $("#content").load(loadLink,"",hideLoader);
>
> > > The file behind loadLink (e.g. contact.php) has some tables with
> > > class="details" and I want them to be hidden and not shown until I
> > > click the link before it.
>
> > > $('.details').hide();
> > > $('.showDetails').click(function() {
> > > $('.details').slideToggle('slow');
> > > return false;
>
> > > });
>
> > > But for some reason it doesn't work. The table .details is displayed
> > > and when I click the link .showDetails nothing happens (I tried to
> > > alert something, nothing here too).
>
> > > I am afraid of it is not working with content loaded dynamically after
> > > my page with the jQuery JS is loaded. Because jQuery doesn't knows the
> > > "new" .details table??