JPM
JPM

Reputation: 1

Javascript link builder within HTML

I'm trying to build a... link builder to ease some of my day-to-day tasks. I can't make it work though, and would really appreciate some help:

<form target="">
  ID one:
  <input type="text" name="IDone" id="ID1">
  
  ID two:
  <input type="text" name="IDtwo" id="ID2">
  
  <button value="go" id="myButton">build</button>
  
  <script type="text/javascript">
    document.getElementById("myButton").onclick = function () {
        location.href = 
          "https://first.part.com/" + document.getElementById("ID1").value +
          "?act=setsecond_part=" + document.getElementById("ID2").value;
    };
  </script>
  
</form>

The idea is very simple:

Thank you for your assistance!

JPM

Upvotes: 0

Views: 362

Answers (1)

kostova
kostova

Reputation: 61

Delete a form tag and everything will be work fine :)

Upvotes: 1

Related Questions