0

I am new node.js. I created one example with node.js .I got one error document is not defined .how to use document in server.js file ,please help me

client.js

<body> 
  <div id = "loginPage" class = "container text-center"> 

     <div class = "row"> 
        <div class = "col-md-4 col-md-offset-4"> 
           <h2>WebRTC Text Demo. Please sign in</h2> 
           <label for = "usernameInput" class = "sr-only">Login</label> 
           <input type = "email" id = "usernameInput" 
              class = "form-control formgroup" placeholder = "Login" 
              required = "" autofocus = "">
           <button id = "loginBtn" class = "btn btn-lg btn-primary btnblock">
              Sign in</button> 
        </div> 
     </div> 

  </div>

server.js

var loginBtn = document.querySelector('#loginBtn');
loginBtn.addEventListener("click", function (event) { 
name = usernameInput.value; 

 if (name.length > 0) { 
  send({ 
     type: "login", 
     name: name 
   }); 
 } 

});

How to get loginbtn value from client to serverside

naresh
  • 41
  • 2
  • 9

0 Answers0