Q:

Linking to another html document when a button is clicked

Am trying to redirect to another html document when a button is clicked. This is my js code:
$('#getTextBoxValue').on("click", function(){
var value = $("#textbox1").val();
});

$('#getTextBoxValue').click(function() {
    window.location.href = 'view.html';
    return false;
});

And this is my html code: 
<form class="col-lg-12">
            <div class="input-group" style="width:500px;text-align:center;margin:0 auto;">
            <input class="form-control input-lg" placeholder="Enter single quote-surrounded link" type="textbox" id="textbox1"></input>
              <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit" id= "getTextBoxValue">Submit</button></span>
            </div>
          </form>
    <script src="js/script.js"></script>
    <script src="js/viewer.js"></script>

Nothing happens when I click the button though, is there a better way to do this? 

A:

An alternative that doesn't need jQuery, only vanilla javascript:
    <script type="text/javascript>
        function goToPage() {
            document.location = 'view.html';
        }
        Button.addEventListener('click', goToPage);
    </script>
    …
    <button id="Button">Go</button>

You create your button element and give it a unique id attribute (it can be any element).
Then you add a click EventListener to it, that executes the specified function goToPage.
The goToPage function changes the document's location to navigate to it.

And one that doesn't even need javascript:
    <form action="view.html">
        <input type="submit" value="Go"/>
    </form>

You only create an input element of type submit.
Then you just put it into a form element with your document's URL as the action.

The advantages of the first approach is that you can make almost any element you want clickable, there are only a few exceptions. The advantage of the second one is that you only use pure HTML.

A:

You don't need any javascript to do this just set your action of your form as below:
<form class="col-lg-12" action="view.html">
            <div class="input-group" style="width:500px;text-align:center;margin:0 auto;">
            <input class="form-control input-lg" placeholder="Enter single quote-surrounded link" type="textbox" id="textbox1"></input>
              <span class="input-group-btn"><button class="btn btn-lg btn-primary" type="submit" id= "getTextBoxValue">Submit</button></span>
            </div>
          </form>
<script src="js/script.js"><\script>
<script src="js/viewer.js"><\script>
</form>

