Kage Kazumi
10-12-2012, 05:07 PM
To understand what I'm trying to do read this topic: Dropdown COntent Filter (http://www.dynamicdrive.com/forums/showthread.php?71640-Dropdown-Content-Filter&p=284359#post284359). However, I found a code that I thought would work, but it is not functioning like it should.
When you select something from the dropdown it should hide the other paragraphs, but it doesn't seem to work for me.
Also the site is not live so that's why their is no link.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
</head>
<body>
<select name="division-select" id="division-select">
<option value="halter">Halter</option>
<option value="english">English</option>
</select>
<div>
<p class="halter">halter class 1</p>
<p class="halter">halter class 2</p>
<p class="english">english class 1</p>
<p class="english">english class 2</p>
</div>
<script>
$("#division-select").bind("change", function() {
$("." + this.value).show();
$("p:not(." + this.value + ")").hide();
});
</script>
</body>
</html>
What am I doing wrong here?
When you select something from the dropdown it should hide the other paragraphs, but it doesn't seem to work for me.
Also the site is not live so that's why their is no link.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
</head>
<body>
<select name="division-select" id="division-select">
<option value="halter">Halter</option>
<option value="english">English</option>
</select>
<div>
<p class="halter">halter class 1</p>
<p class="halter">halter class 2</p>
<p class="english">english class 1</p>
<p class="english">english class 2</p>
</div>
<script>
$("#division-select").bind("change", function() {
$("." + this.value).show();
$("p:not(." + this.value + ")").hide();
});
</script>
</body>
</html>
What am I doing wrong here?