Title: My code not work
Last modified: August 20, 2016

---

# My code not work

 *  [dammion](https://wordpress.org/support/users/dammion/)
 * (@dammion)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/my-code-not-work/)
 * why my code not work?
 *     ```
       <?php print wpbusdirman_post_list_categories(); ?>
       		<script type="text/javascript">
           var dropdown = document.getElementById("cat");
           function onCatChange() {
       		if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
   
       			location.href = "<?php get_category_link('cat=?>"+dropdown.options[dropdown.selectedIndex].value+"<?php ') ?>";
       		}
           }
           dropdown.onchange = onCatChange;
       	</script>
       		</div>
       ```
   
 * that codes generates a select box
 *     ```
       <<select name="cat" id="cat" class="postform">
       	<option class="level-0" value="14736">Jakarta Selatan&nbsp;&nbsp;(1)</option>
       	<option class="level-0" value="14737">Jakarta Timur&nbsp;&nbsp;(1)</option>
       	<option class="level-0" value="14726">Jakarta Utara&nbsp;&nbsp;(1)</option>
       </select>
       ```
   
 * can anyone help me?? i want to use wp dropdown category without using submit 
   button

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [dammion](https://wordpress.org/support/users/dammion/)
 * (@dammion)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/my-code-not-work/#post-2714010)
 * i’m sorry.. this is the script..
 * >  <?php print wpbusdirman_post_list_categories(); ?>
   >  <script type=”text/javascript”
   > > var dropdown = document.getElementById(“cat”); function onCatChange() { if(
   > dropdown.options[dropdown.selectedIndex].value > 0 ) {
   >  location.href = “<?php get_category_link(‘cat=?>”+dropdown.options[dropdown.
   > selectedIndex].value+”<?php ‘) ?>”;
   >  } } dropdown.onchange = onCatChange; </
   > script>
 *  Thread Starter [dammion](https://wordpress.org/support/users/dammion/)
 * (@dammion)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/my-code-not-work/#post-2714011)
 * i’m really sorry.. this is the real code.. please anybody help me..
 *     ```
       <?php print wpbusdirman_post_list_categories(); ?>
       		<script type="text/javascript">
           var dropdown = document.getElementById("cat");
           function onCatChange() {
       		if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
   
       			location.href = "<?php get_category_link('cat="+dropdown.options[dropdown.selectedIndex].value+" ') ?>";
       		}
           }
           dropdown.onchange = onCatChange;
       	</script>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘My code not work’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [dammion](https://wordpress.org/support/users/dammion/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/my-code-not-work/#post-2714011)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
