Change url when dropdown item is selected
I've got three dropdown boxes on the same page and when a value is selected I need it to change the page to the url that is in the value field. All the drop down boxes are exactly the same except for the values. Below I have my html and then the js I thought might work but evidently doesn't.
- <script type="text/javascript">
- $(document).getElementByClass('images-size-dropdown').selectedIndex(function(){
- if ($(this).value != 'None') {
- window.location.href = "http://www.mysite.com/' + $(this).value;
- };
- });
- </script>
All three drop downs look like this one. None of them have id's. Was hoping to keep the js simple and not have to write the same code 3x's for different id's.
- <select class="image-size-dropdown">
- <option value="resources/images1.jpg">Image 1</option>
- <option value="resources/images2.jpg">Image 2</option>
- <option value="resources/images3.jpg">Image 3</option>
- <option value="resources/images4.jpg">Image 4</option>
- </select>