HTML:
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style2.css">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
$(document).ready(function){
$("#listitem1").click(function){
$("#listitem2").toggle();
}
}
</script>
</head>
<body>
<div id="listitem1">
</li>
<div id="listitem2">
</div>
</body>
</html>
Code:
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
body {
margin: 0;
}
p {
margin: 0;
}
#listitem1 {
margin: 0;
width: 100%;
height: 100px;
background: #999;
}
#listitem2 {
margin: 0;
width: 100%;
height: 100px;
background: #000;
}
Ik wil dat als ik op #listitem1 klik dat dan #listitem2 weggaat en als ik dan nog een keer op #listitem1 klik dat #listitem2 dan weer terugkomt.
Dit wil ik doen met jQuery, maar het lukt niet echt.
Heeft dit misschien te maken met dat je jQuery moet downloaden op je server en je het niet offline kan doen? Of is de code gewoon niet goed?
Laatst bewerkt door een moderator: