Drop down menu open link onClick – HELP!
-
Ok, so I have built a menu for category pages but can’t get clicks to trigger the page – seems stupid, I know – but I’m pretty new to this. Any ideas? Here is my menu:
`<?php echo category_description( $categoryID );
$ancestor = null;
$childcats = get_categories(‘child_of=’ . $cat . ‘&hide_empty=1’);
if(!empty($childcats)){
echo ‘<select id=”subCats”‘;
foreach ($childcats as $childcat) {
if (cat_is_ancestor_of($ancestor, $childcat->cat_ID) == false){
echo ‘<option value=”‘.get_category_link($childcat->cat_ID).'”>’;
echo $childcat->cat_name . ‘</option>’;
$ancestor = $childcat->cat_ID;
}
}
echo ‘</select>’;
}?>`
I’ve tried the following jQuery but really don’t know where to put it, or what the ‘#subCats’ should actually be.
<script type="language/javascript> $(document).ready(function(){ $('#subCats').change(function(){ window.location = $(this).val(); }) }); </script>
- The topic ‘Drop down menu open link onClick – HELP!’ is closed to new replies.