Q:

Add string and input select value to url onchange and page load

I have a code below that adds a string along with the value of a input select when the page is loaded. The code below somewhat works but there's long unrecognizable string after the = sign.
I also need for the code to load when the page is loaded.
In other word, the url should also includes the appended text when the page is loaded.
Can anyone help?  
<script>
  $(document).ready(function() {
    $("#staff-list").on('change', function() {
      location.href = "?account=" + $(this).val;
    });
  });
</script>

A:

You should change the line, where you append URL from,
location.href = "?account=" + $(this).val;  to,
location.href = "?account=" + $(this).val();
and you want your code to return the appended URL, you can do like,  
    <script>
      $(document).ready(function() {
        $("#staff-list").on('change', function() {
           $("#id_of_a").attr("href","somefile.php?account=" + $(this.val());
        });
      });
    </script>

I'm not sure what your code scenario is, but this might help.

