title: Getting title from WKWebView using evaluateJavaScript
body: <p>I have a very simple/easy question but have absolutely zero experience with java. I have a <code>WKWebView</code> and I want to get the title text of the page using the javascript <code>document.getElementById</code>.</p>
  
  <p>The webpage I am trying to get the title from has this code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;div class="toolbar"&gt;
  &lt;h1 id="pageTitle"&gt;Schedules&lt;/h1&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;html&gt;
  </code></pre>
  
  <p>This code is abridged so I apologize for any errors.</p>
  
  <p>Then I am trying to access the pageTitle in Swift with:</p>
  
  <pre><code>func webView(webView: WKWebView, didFinishNavigation navigation: WKNavigation!) {
  
      webView.evaluateJavaScript("document.getElementById('pageTitle').value") { (result, error) -&gt; Void in
          if error != nil {
              print(result)
          }
      }
  }
  </code></pre>
  
  <p>And the result is returning nil. After hours of searching I still have no idea how to get this to work. Any help is appreciated.</p>