Skip to content

Commit

Permalink
removing Enter
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeGuilherme committed Sep 9, 2024
1 parent 6e12bfb commit 47980b2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ moveBySearch = (val, searchEl) => {
loadSearch = (searchElId) => {
let searchEl = document.getElementById(searchElId);
let slideIndex = getSlideIndex(activeSlide);
if(slideIndex > 2 && slideIndex < 7){

if (slideIndex > 2 && slideIndex < 7) {
searchEl.style.display = 'block';
} else {
return;
Expand All @@ -286,18 +287,18 @@ loadSearch = (searchElId) => {
<div style="display: flex; align-items: center; margin: 5px;">
<span style="margin-right: 5px;">MI:</span>
<input id="input" type="text" style="flex: 1; padding: 5px;" placeholder="MI/INOM"/>
<button id="searchBtn" style="cursor: pointer; margin-left: 5px; padding: 5px;">🔍</button>
</div>
`;

searchEl.innerHTML = input;

let inputField = document.getElementById('input');

let searchBtn = document.getElementById('searchBtn');
searchBtn.addEventListener('click', function() {
let value = inputField.value;
moveBySearch(value, searchEl)
inputField.addEventListener('keydown', function(event) {
if (event.key === 'Enter') {
let value = inputField.value;
moveBySearch(value, searchEl);
}
});
};

Expand Down

0 comments on commit 47980b2

Please sign in to comment.