<div th:fragment="article-search-input">

  <div class="index-search">
    <input class="index-search-input" th:value="${parameters != null ? parameters.title : ''}" id="searchInput" type="text"
       th:placeholder="#{search.input.placeholder}" maxlength="25">
    <a href="javascript:;" id="searchBtn" class="index-search-btn"><i class="icon-search-white"></i></a>
  </div>
  <script>
    $('#searchBtn').on('click', function() {
        var val = $('#searchInput').val()
        if (val) {
          window.location.href = '/article/list?title=' + val
        } else {
          window.location.href = '/article/list'
        }
    })
    $('#searchInput').on('keydown', function(e) {
        if (e.keyCode === 13) $('#searchBtn').click()
    })
  </script>

</div>