Umer Farooq
Umer Farooq

Reputation: 593

Html tags doesn't work

I want to open a new html file by clicking a submit button but it doesn't work my code is here

HTML

<div class="col-sm-offset-3 col-sm-3">
                        <button id="submit" type="submit" class="btn btn-default" onclick="submitFunction()">Confirm SignUp</button>
                    </div>

JavaScript

<script type="text/javascript">
        function submitFuntion(){
            if(document.getElementById('submit').onclick){
                document.write("<a href='info.html'></a>");
            }
        }
    </script>

Upvotes: 0

Views: 56

Answers (3)

Mathews Mathai
Mathews Mathai

Reputation: 1707

<button type="submit" id="submit" class="btn btn-default" onclick="location.href='info.html'">Confirm SignUp </button>

This will help you navigate to the page info.html on clicking the submit button.

Upvotes: 1

sayCrispy
sayCrispy

Reputation: 61

Solution with form/submit:

<div class="col-sm-offset-3 col-sm-3">
  <form action="info.html">
    <button 
      id="submit" 
      type="submit" 
      class="btn btn-default">
        Confirm SignUp
    </button>
  </form>
</div>

Upvotes: 1

Akshey Bhat
Akshey Bhat

Reputation: 8545

Place submit button inside a form tag and set its attribute action to info.html. that way when you click on submit info.html will open. No need of click event for submit button

Upvotes: 1

Related Questions