Q:

Redirect after Login validation using Button in Cordova

I am a beginner in Cordova language. I am trying to redirect my html page on button click in javascript. Here in validateform method I want to redirect to my home page. I have tried all possible things like window.location, document.location . But I am not getting exact answer to redirect. 
<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript">
        window.onload = function()
        {
            document.addEventListener("deviceready", init, false);
        }

    function init()
    {
        var myButton = document.getElementById("BtnClick");
        myButton.addEventListener("click", validateform, false);
    }

    function validateform()
    {
        var myButton = document.getElementById("BtnClick");
        var user = document.getElementById("username").value;
        var paswd = document.getElementById("password").value;
        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

        if (user == "") {
            alert("Name must be filled out");
            return false;
        } else if (reg.test(user) == false) {
            alert("Invalid Email Address");
            return false;
        } else  if (paswd == "") {
            alert("Password must be filled out");
            return false;
        } else {
            alert("TRY!");
            document.location = "home.html";
            return false;
        }
    }
        </script>

    <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
        <meta name="format-detection" content="telephone=no">
            <meta name="msapplication-tap-highlight" content="no">
                <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
                    <link rel="stylesheet" type="text/css" href="css/index.css">
                        </head>

<body>
    <form id="loginForm" class = "centered" >
        <div class="middle">
            <img src = "img/newlogo.png" width="150" height="150"/>
        </div>

        <div data-role="fieldcontain">
            <input type="email" name="username" id="username" value="tst@test.com" placeholder="Username" class="middle textfield"/>
        </div>

        <div data-role="fieldcontain" >
            <input type="password" name="password" id="password" value="789456" placeholder="Password" class="middle textfield" maxlength="10"/>
        </div>

        <div class = "middle">
            <button id = "BtnClick" class = "button" >Submit</button>
        </div>
    </form>
</body>
</html>

A:

Thanks for all help! I found the solution:
In index.html
<div class = "loginButton">
      <a id = "BtnClick">Submit</a>
</div>

In validateformmethod:
window.location.href = "home.html";

