autofocus input field if there is no query
authorChristian Weiske <cweiske@cweiske.de>
Thu, 24 Nov 2016 21:24:17 +0000 (22:24 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 24 Nov 2016 21:24:17 +0000 (22:24 +0100)
data/templates/base.htm
data/templates/search.htm

index f4bb38a..0f5bd13 100644 (file)
@@ -22,7 +22,7 @@
       </li>
      </ul>
      <form class="navbar-form pull-left" method="get" action="/">
-      <input type="text" name="q" placeholder="Search"
+      <input type="text" name="q" placeholder="Search" id="searchq"
              value="{{query}}" class="input-xxlarge"/>
       {% if siteParam %}
       <input type="hidden" name="site" value="{{site}}"/>
index b1a4c2a..37292ef 100644 (file)
@@ -35,4 +35,9 @@
     {% endif %}
    </div>
   </div>
+  {% if not query %}
+  <script type="text/javascript">
+   document.getElementById("searchq").focus();
+  </script>
+  {% endif %}
 {% endblock %}