Javascript script tag not working



I’ve been trying to link a javascript file to my html file, I’ve tried using a separate document and putting that file path as the src attribute in a script tag on my html but that didn’t work, I’ve tried putting the javascript inside the script tag on the actual html file and that hasn’t worked either. I’ve had several developers look at my code and even clone my github repo and use it but they are not reproducing the same problem and all their suggestions haven’t worked. Here is what I currently have in my html file:

<!DOCTYPE html>
<link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="/css/main.css">
<script type="text/javascript">
  document.addEventListener("DOMContentLoaded", function(event) { 
        if (document.getElementById("title").value()!=="" && document.getElementById("options").value!=="") {
    document.getElementsByClassName('main').click(function() {
<nav class="navbar navbar-default">
<div class="container-fluid">
<p class="navbar-text"><a href="/">Voting App</a></p>
<button type="button" class="btn btn-default navbar-btn navbar-right" id="logout"><a href="/logout">Log Out <image src="/img/github.png">
 <ul class="nav navbar-nav navbar-right">
<li><a href="#" class="polls" id="newpoll">New Poll</a></li>
<li><a href="#" class="polls" id="mypolls">My Polls</a></li>
<div class="main">
        <div class="title form-group">
    <label for="title">Title:</label>
    <input type="title" class="form-control" id="title" placeholder="Title">
    <div class="options form-group">
      <label for="options">Options:</label>
      <input type="text" class="form-control" placeholder="Ex: cats, dogs, horses" id="options">
      <div class="submit form-group">
      <button class="btn btn-default" type="submit" id="submitchart" disabled>Submit</button>


window.onkeypress is not a function. You probably want to use document.addEventListener("keydown", function() {}). When you run this page in chrome you can open developer tools (F12 on windows or Cmd + Alt +J on OSX) to see the Javascript error.