More actions
Focus input instead of simulating a keypress |
Make it flash to draw attention |
||
| Line 4: | Line 4: | ||
searchInput.onclick = function() { | searchInput.onclick = function() { | ||
var realSearch = document.querySelector('.cdx-text-input__input'); | var realSearch = document.querySelector('.cdx-text-input__input'); | ||
// Set focus | |||
realSearch.focus(); | realSearch.focus(); | ||
// Make it flash to draw attention | |||
realSearch.style.backgroundColor = '#FEF184' | |||
setTimeout(function() { | |||
realSearch.style.backgroundColor = ''; | |||
}, 500); | |||
}; | }; | ||
Latest revision as of 14:04, 5 June 2025
/* All JavaScript here will be loaded for users of the Vector skin */
// Make the search bar on Template:Home/nav activate search.
var searchInput = document.getElementById('home-search');
searchInput.onclick = function() {
var realSearch = document.querySelector('.cdx-text-input__input');
// Set focus
realSearch.focus();
// Make it flash to draw attention
realSearch.style.backgroundColor = '#FEF184'
setTimeout(function() {
realSearch.style.backgroundColor = '';
}, 500);
};