Title: Javascript variable passing
Last modified: August 19, 2016

---

# Javascript variable passing

 *  [coppertopjsq](https://wordpress.org/support/users/coppertopjsq/)
 * (@coppertopjsq)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/javascript-variable-passing/)
 * I know have very little programing skills but I am trying to borrow the code 
   from the category drop down widget to make one for tags. I got the code to work
   so far like this
 * <script lang=’javascript’><!–
    var dropdown = document.getElementById(“products”);
   function onCatChange() { { location.href = “<?php echo get_option(‘home’); ?>/?
   tag=”+dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange =
   onCatChange; –></script>
 * It access the tags from the custom form I have created. What I need to do is 
   create a second form so that they would interact like this
 * <script lang=’javascript’><!–
    var dropdown = document.getElementById(“counties”);
   function onCatChange() { { counties = “+dropdown.options[dropdown.selectedIndex].
   value; } } dropdown.onchange = onCatChange; –></script>
 * <script lang=’javascript’><!–
    county = ‘+’.counties; var dropdown = document.
   getElementById(“products”); function onCatChange() { { location.href = “<?php
   echo get_option(‘home’); ?>/?tag=”+dropdown.options[dropdown.selectedIndex].value.
   county; } } dropdown.onchange = onCatChange; –></script>
 * I don’t know how to get the variable counties to pass over to the second script.
 * Thanks.

The topic ‘Javascript variable passing’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [coppertopjsq](https://wordpress.org/support/users/coppertopjsq/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/javascript-variable-passing/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
