This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 13th, 2012  |  syntax: JavaScript  |  size: 0.76 KB  |  views: 42  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.   <script src="http://code.jquery.com/jquery-latest.js"></script>
  2.   <script type = "text/javascript">
  3.  
  4.   function getUrlVars() {
  5.     var vars = {};
  6.     var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
  7.         vars[key] = value;
  8.     });
  9.     return vars;
  10.   }
  11.  
  12.   $(document).ready(function() {
  13.  
  14.        var getParams = getUrlVars();
  15.        if (getParams) {
  16.           $('#dynamic-select').val(getParams.selected);
  17.        }
  18.  
  19.       $('#dynamic-select').bind('change', function () {
  20.              
  21.           var url = $(this).val();
  22.           if (url != '') {
  23.               window.location.href = window.location.href + "?selected="+url;
  24.           }
  25.           return false;
  26.       });
  27.   });
  28.    
  29.   </script>
clone this paste RAW Paste Data