Greetings.
Tell me, please, how to make the modal block disappear when you click on any other element besides input itself.
$(document).click(function(e){ if ($(e.target).is('#search')) { $('#modalsearch').fadeIn(); } }) @charset "UTF-8"; .modal { top: 0; left: 0; position: fixed; width: 100%; height: 100%; display: none; justify-content: center; z-index: 6; } .modal::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; opacity: 0.8; } .modal__input { width: 100%; padding: 15px 25px; border-radius: 50px; font-size: 1.25em; } .modal__input:focus::placeholder { opacity: 0; } .modal__input::placeholder { color: #8d8d8d; transition: all 0.1s linear; } .modal__input_wrap { position: relative; grid-column: 3/11; margin: 210px 0 0 0; z-index: 7; } .modal__input_wrap::after { position: absolute; font-family: FontAwesome; content: ""; font-size: 1em; color: #ffc100; right: 22.5px; top: 19px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button class="searchopen" id="search">open</button> <div class="modal modal__search" id="modalsearch"> <div class="container"> <div class="modal__input_wrap"> <input class="modal__input" id="#searchinput" type="text" placeholder="Lūdzu ievadiet meklējamo vārdu vai frāzi"> </div> </div> </div>