N_A
N_A

Reputation: 29

Javascript and Wordpress: JS not loaded

I am working on this Wordpress website and i am a using a bit of JS to animate the table.

What i need is to "filter" the Table rows when a checkbox on top is selected. For example when Zimmer -> 4.5 is selected, only the rows with class .zimmer4 are displayed. I am using now this script but does not works:

JS:

$(document.body).on('change', "#zimmer5", function() { 
    $("#tableID tr.zimmer5").toggle(!this.checked); 
});    

$(document.body).on('change', "#zimmer4", function() { 
    $("#tableID tr.zimmer4").toggle(!this.checked); 
});

$(document.body).on('change', "#zimmer3", function() { 
    $("#tableID tr.zimmer3").toggle(!this.checked); 
});

$(document.body).on('change', "#zimmer2", function() { 
    $("#tableID tr.zimmer2").toggle(!this.checked); 
});

This is the HTML code i am using for the buttons

HTML

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<span class="dropdown">
        <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Zimmer
        <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<form class="filter">
<input id="zimmer4" class="unchecked" type="checkbox">4.5
<br>
<input id="zimmer3" class="unchecked" type="checkbox">3.5
<br>
<input id="zimmer2" class="unchecked" type="checkbox">2.5
<br>
</form>
</ul>
</span>

Upvotes: 0

Views: 43

Answers (1)

Martin Hugo
Martin Hugo

Reputation: 184

replace your $ sign with jQuery

Upvotes: 1

Related Questions