Created
August 10, 2008 21:42
-
-
Save jackdempsey/4777 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<label>Department:</label> | |
<select id="blog_department_id" name="blog[department_id]"> | |
<option value="1" selected="selected">My World</option> | |
<option value="2">Around Town</option> | |
<option value="3">Lifestyles & Living</option> | |
<option value="4">Arts & Entertainment</option> | |
<option value="5">Style & Fashion</option> | |
<option value="6">Sports & Fitness</option> | |
<option value="7">Business & Careers</option> | |
<option value="8">Science & Technology</option> | |
<option value="9">Society & World</option> | |
<option value="10">Travel & Leisure</option> | |
<option value="11">Offbeat & WTF</option> | |
<option value="12">Random Thoughts</option> | |
</select> | |
<label>Channel:</label> | |
<select id="blog_channel_id" name="blog[channel_id]"> | |
<option value="4-1">Music</option> | |
<option value="8-2">Open Source</option> | |
<option value="8-3">Closed Source</option> | |
<option value="4-4">Impressionisism</option></select> | |
<script type="text/javascript" charset="utf-8"> | |
//<![CDATA[ | |
jQuery(function($){ | |
// call on page load to start filter off correctly | |
filterChannels($("#blog_department_id").val()); | |
// call anytime menu is changed | |
$("#blog_department_id").change( function() { $('#blog_channel_id').options = filterChannels($(this).val()) } ); | |
function filterChannels(department_id) { | |
$('#blog_channel_id option').filter(function() { | |
return this.value.match(/^8/) != null; | |
}); | |
} | |
}); | |
//]]> | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment