Getting the 2nd child element

Written by leif. Posted in Javascript, Programmering, Tips

A number of ways to do this one. I’m going to assume the toplevel div has an id of ‘top’. This is probably the best one:

$('#top > :nth-child(2)').whatever();



or if you know for a fact there are at least 2 children


JQuery slideToggle flere elementer

Written by r2d2. Posted in Javascript

<!DOCTYPE html>
<script src="">

<h2>This is a heading</h2>
<div class="containerdiv">klik her
<div class="inch">dette er teksten.</div>
<div class="containerdiv">klik her2
<div class="inch">dette er teksten2.</div>