get_terms() with javascript?
-
Hey guys,
I have the following situation:
For one of my Websites I need a extended Searchform (taxonomy picking). This is my code, so far:<select id="hersteller" name="hersteller" onchange="showTextBox(this.value)+showcategory(this.value)"> <option value="Hersteller">Hersteller</option> <?php $terms = get_terms('category'); foreach ($terms as $term) { printf( '<option id="hersteller" class="level-0" value="%s">%s</option>', $term->slug, $term->name ); </select> <div id="modell" style="display:none"> <select name="Modell"> <option value="Modell">Modell</option> <?php $terms = get_terms('marke-<strong>HERE GOES THE SELECTED CATEGORY</strong>'); foreach ($terms as $term) { printf( '<option class="level-0" value="%s">%s</option>', $term->slug, $term->name ); } ?> </select> </div>
Inside get_terms(”) some javascript needs to pick the selected category name. For this I tried a function:
get_terms('marke-'.'<script type="text/javascript"> function showcategory(made){document.write(hersteller.options[hersteller.selectedIndex].value; }</script>'.'');
It did not work at all, I tried so much more, but nothing helped. Does anyone have an idea? I am very happy about any suggestion!!
Cheers Felix
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘get_terms() with javascript?’ is closed to new replies.