-2

I wanted to do something like, when I click the radio button it goes to another HTML.

my code:

<div class="FilterNetwork">
  <div class="network">
    <input type="radio" value="Expertise" unchecked name="radioBtn" onclick="expertise.html"> <label> Expertise</label><br>
    <input type="radio" value="Location" unchecked name="radioBtn"> <label> Location</label><br>
    <input type="radio" value="Workplace" unchecked name="radioBtn"> <label> Workplace </label><br>
    <input type="radio" value="Past Job" unchecked name="radioBtn"> <label>Past Job</label><br>
  </div>
</div>
Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58

2 Answers2

0

Adjust the onclick attribute, example onclick="location.href='example.html'".

0

You could create a javascript class that does something like:

<div class="FilterNetwork">
  <div class="network">
    <input type="radio" value="Expertise" unchecked name="radioBtn" onclick="dosomething(Expertise)"> <label> Expertise</label><br>
    <input type="radio" value="Location" unchecked name="radioBtn" onclick="dosomething(Location)"> <label> Location</label><br>
    <input type="radio" value="Workplace" unchecked name="radioBtn" onclick="dosomething(Workplace)"> <label> Workplace </label><br>
    <input type="radio" value="Past Job" unchecked name="radioBtn" onclick="dosomething(PastJob)"> <label>Past Job</label><br>
  </div>
</div>

<SCRIPT>
function DoSomething(foo) {
if (foo = 'Expertise') {
window.location.replace("expertise.html");
}
else if (...) {}
else if (...) {}
else if (...) {}
}
</SCRIPT>

This also could allow you to pass a variable inside of () that specifies different actions for each button. Cheers