How can I create an expanding search box in Bootstrap, Drupal 8?
How can I create an expanding search box in Bootstrap, Drupal 8?
I'm trying to make my search box expand upon clicking the search icon and submit when clicked again. My search block markup currently looks like this:
<div class="search-block-form contextual-region block block-search block-search-form-block" data-drupal-selector="search-block-form" id="block-mytheme-search" role="search">
<h2 class="visually-hidden">Search</h2>
<div data-contextual-id="block:block=mytheme_search:langcode=en" class="contextual" role="form">
<button class="trigger focusable visually-hidden" type="button" aria-pressed="false">Open Search configuration options</button>
</div>
<form action="/search/node" method="get" id="search-block-form" accept-charset="UTF-8" data-drupal-form-fields="edit-keys">
<div class="form-item js-form-item form-type-search js-form-type-search form-item-keys js-form-item-keys form-no-label form-group">
<label for="edit-keys" class="control-label sr-only">Search</label>
<div class="input-group">
<input title="Enter the terms you wish to search for." data-drupal-selector="edit-keys" class="form-search form-control" placeholder="Search" id="edit-keys" name="keys" value="" size="15" maxlength="128" type="search">
<span class="input-group-btn">
<button type="submit" value="Search" class="button js-form-submit form-submit btn-primary btn icon-only" name="">
<span class="sr-only">Search</span>
<span class="icon glyphicon glyphicon-search" aria-hidden="true"></span></button></span></div>
</div>
<div class="form-actions form-group js-form-wrapper form-wrapper" data-drupal-selector="edit-actions" id="edit-actions"></div>
</form>
</div>
I've tried following several css tutorials or looking at other code snippets people have posted, but I get lost when they use javascript or don't use a button. Any help would be greatly appreciated.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.