HTML:
Kod
<!DOCTYPE html>
<html>
<head>
<title>jquery.animeplay.search_engine.js</title>
<meta name="description" content="" />
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<meta charset=utf-8 />
</head><body>
<form><input class="find" type="checkbox" id="one">1
<input class="find" type="checkbox" id="two">2
<input class="find" type="checkbox" id="three">3
<br>
Tytuł:<input type="text" class="find">
<br>
Rodzaj:
<select>
<option>Wszystkie</option>
<option>TV</option>
<option>OVA</option>
<option>MOV</option>
<option>SP</option>
<option>ONA</option>
<option>PD</option>
</select>
<br>
Widownia:
<select>
<option>Wszystkie</option>
<option>Josei</option>
<option>Kodomo</option>
<option>Seinen</option>
<option>Shoujo</option>
<option>Shounen</option>
</select>
<br>
Odcinków:
<input type="number" min="0" value="0"> - <input type="number" min="0" value="0">
<br><br>----------------<br><br>
<div name="jeden" class="checkme one">1</div>
<div name="jeden" class="checkme two">2</div>
<div name="" class="checkme one two">1 2</div>
<div name="" class="checkme" id="none"> - Nic nie pasuje - </div>
</form>
</body>
</html>
<html>
<head>
<title>jquery.animeplay.search_engine.js</title>
<meta name="description" content="" />
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<meta charset=utf-8 />
</head><body>
<form><input class="find" type="checkbox" id="one">1
<input class="find" type="checkbox" id="two">2
<input class="find" type="checkbox" id="three">3
<br>
Tytuł:<input type="text" class="find">
<br>
Rodzaj:
<select>
<option>Wszystkie</option>
<option>TV</option>
<option>OVA</option>
<option>MOV</option>
<option>SP</option>
<option>ONA</option>
<option>PD</option>
</select>
<br>
Widownia:
<select>
<option>Wszystkie</option>
<option>Josei</option>
<option>Kodomo</option>
<option>Seinen</option>
<option>Shoujo</option>
<option>Shounen</option>
</select>
<br>
Odcinków:
<input type="number" min="0" value="0"> - <input type="number" min="0" value="0">
<br><br>----------------<br><br>
<div name="jeden" class="checkme one">1</div>
<div name="jeden" class="checkme two">2</div>
<div name="" class="checkme one two">1 2</div>
<div name="" class="checkme" id="none"> - Nic nie pasuje - </div>
</form>
</body>
</html>
JQuery:
Kod
all = 0;
allvalue = 0;
$('.find').change(function() {
all = 0;
allvalue = 0;
name = false;
$('div.checkme').each(function() {
$(this).attr('value', 0);
});
$('.find[type="checkbox"]').each(function() {
if( $(this).is(':checked') ){
all = all + 1;
}
});
$('.find[type="text"]').each(function() {
if( $(this).attr('value') !== "" ){
all = all + 1;
}
});
$('div.checkme').each(function() {
div = $(this);
value = $(this).attr('value');
$('.find[type="checkbox"]').each(function() {
check = $(this);
if( div.hasClass( check.attr('id') )){
if( check.is(':checked')){
allvalue = allvalue + 1;
value = value + 1;
}
}
});
$('.find[type="text"]').each(function() {
check = $(this);
if( check.attr('value') !== "" ){
if( check.attr('value') !== div.attr('name') ){
allvalue = allvalue + 1;
value = value + 1;
}
}
});
div.attr('value', value);
if( div.attr('value') === "0" ){
if(all !== 0){
div.hide();
}else{
div.show();
}
}else{
div.show();
}
});
if(allvalue === 0){
if( all !== 0 ){
$('.checkme#none').show();
}else{
$('.checkme#none').hide();
}
}else{
$('.checkme#none').hide();
}
});
if(allvalue === 0){
if( all !== 0 ){
$('.checkme#none').show();
}else{
$('.checkme#none').hide();
}
}else{
$('.checkme#none').hide();
}
allvalue = 0;
$('.find').change(function() {
all = 0;
allvalue = 0;
name = false;
$('div.checkme').each(function() {
$(this).attr('value', 0);
});
$('.find[type="checkbox"]').each(function() {
if( $(this).is(':checked') ){
all = all + 1;
}
});
$('.find[type="text"]').each(function() {
if( $(this).attr('value') !== "" ){
all = all + 1;
}
});
$('div.checkme').each(function() {
div = $(this);
value = $(this).attr('value');
$('.find[type="checkbox"]').each(function() {
check = $(this);
if( div.hasClass( check.attr('id') )){
if( check.is(':checked')){
allvalue = allvalue + 1;
value = value + 1;
}
}
});
$('.find[type="text"]').each(function() {
check = $(this);
if( check.attr('value') !== "" ){
if( check.attr('value') !== div.attr('name') ){
allvalue = allvalue + 1;
value = value + 1;
}
}
});
div.attr('value', value);
if( div.attr('value') === "0" ){
if(all !== 0){
div.hide();
}else{
div.show();
}
}else{
div.show();
}
});
if(allvalue === 0){
if( all !== 0 ){
$('.checkme#none').show();
}else{
$('.checkme#none').hide();
}
}else{
$('.checkme#none').hide();
}
});
if(allvalue === 0){
if( all !== 0 ){
$('.checkme#none').show();
}else{
$('.checkme#none').hide();
}
}else{
$('.checkme#none').hide();
}
Proszę o pomoc!