Hello guys,
first things first excuse me for my bad english.
So here's my story:
I want to get through 8 Checkboxes, to proof if they are checked or not.
In case one of them is checked, i get the name, or better the ID of it, to activate the <div> it belongs to.
So here are the Checkboxes:
- <input type="checkbox" class="checkbox" name="1" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 1
- <input type="checkbox" class="checkbox" name="5" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 5
- <br />
<input type="checkbox" class="checkbox" name="2" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 2
- <input type="checkbox" class="checkbox" name="6" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 6
- <br />
<input type="checkbox" class="checkbox" name="3" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 3
- <input type="checkbox" class="checkbox" name="7" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 7
- <br />
<input type="checkbox" class="checkbox" name="4" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 4
- <input type="checkbox" class="checkbox" name="8" onclick="$('#' + $(this).attr('name')).toggle()"/> Thema 8
- <br />
Dont mind the source code at "onclick".
And here the 8 <div>:
- <div id="Spalte">
<div class="thema" id="1">Thema 1</div>
<div class="thema" id="2">Thema 2</div>
<div class="thema" id="3">Thema 3</div>
<div class="thema" id="4">Thema 4</div>
</div>
<div id="Spalte">
<div class="thema" id="5">Thema 5</div>
<div class="thema" id="6">Thema 6</div>
<div class="thema" id="7">Thema 7</div>
<div class="thema" id="8">Thema 8</div>
</div>
And heres the for-Loop, which im using to get through the checkboxes:
- for (i = 0; i < 8; i++) {
if ($(".checkbox").get(i).is(":checked")) {
$('#' + $($(".checkbox").get(i)).attr('name')).show();
}
else {
$('#' + $($(".checkbox").get(i)).attr('name')).hide
alert($(".checkbox").get(i));
}
}
The problem is, that i cant use .is after I used get(i).
But just why?
After I used get(), its an object, but it seems like it isn't.
Is this actually a bug or somethin? I got Jquery a few months ago, maybe it's fixed yet.
Or is it just me doing something wrong?
Please help me.