MediaWiki:Common.js: различия между версиями

Страница интерфейса MediaWiki
Нет описания правки
Нет описания правки
Строка 2: Строка 2:
     var searchButton = document.getElementById('citizen-search__buttonCheckbox');
     var searchButton = document.getElementById('citizen-search__buttonCheckbox');
     if (searchButton) {
     if (searchButton) {
         searchButton.addEventListener('click', function() {
         searchButton.addEventListener('click', function(event) {
            event.preventDefault();
             var searchInput = document.querySelector('#searchform input[name="search"]');
             var searchInput = document.querySelector('#searchform input[name="search"]');
             if (searchInput) {
             if (searchInput) {

Версия от 02:36, 18 апреля 2025

document.addEventListener('DOMContentLoaded', function() {
    var searchButton = document.getElementById('citizen-search__buttonCheckbox');
    if (searchButton) {
        searchButton.addEventListener('click', function(event) {
            event.preventDefault();
            var searchInput = document.querySelector('#searchform input[name="search"]');
            if (searchInput) {
                searchInput.focus();
            }
        });
    }
});