edude05
edude05

Reputation: 754

How do I use the onselect method of Jquery to goto a URL?

What I want to to is pretty basic. I have files that are number with dates, and when someone clicks a date on the calendar it should open that file.

For example, if someone clicks november 20th it should go to nov/20.htm or generally {month}/{day}.htm.

I've looked at the documentation and it mentions something about being able to call onselect: function(); but I'm not versed enough in jquery to know what function to call to do so.

So how do I do this?

Upvotes: 1

Views: 310

Answers (1)

funwhilelost
funwhilelost

Reputation: 2010

When someone selects something from the box it will trigger the function:

$("#selectbox").change(function() {
    var selectedValue = $(this).val();

    // parse the value to the page you want
    var newURL = "...";

    location.href = newURL;    
});

Upvotes: 1

Related Questions