0

Hello everyone! I just want to ask, when I choose regular in my drop down. The link goes to the regular.html as well as the contractual. How can I do it? Thank you in advance. :)

Also here's my code for the regular.html: regular.html

<html>
<head>
    <title>Drop down</title>
</head>
<body>
    <h1>Regular</h1>
    <select>
        <option href="regular.html">Regular</option>
        <option href="contractual.html">Contractual</option>
    </select>
</body>
</html>

And this is for the contractual: contractual.html

<html>
<head>
    <title>Drop down</title>
</head>
<body>
    <h1>Contractual</h1>
    <select>
        <option href="regular.html">Regular</option>
        <option href="contractual.html">Contractual</option>
    </select>
</body>
</html>
Francis Vargas
  • 57
  • 1
  • 1
  • 8

2 Answers2

0

You can try this:

$('select').change(function(){
    var url = $('option:selected', this).attr('href');
    window.location.href = url;
});
Lakhan
  • 12,328
  • 3
  • 19
  • 28
0
    <h1>Main Page</h1>
    <select onchange="location = this.options[this.selectedIndex].value;">
        <option value="regular.html">Regular</option>
        <option value="contractual.html">Contractual</option>
    </select>
S M
  • 3,133
  • 5
  • 30
  • 59