selftrips
@selftrips

Как всталять JS код на сайт Wordpress?

Пытаюсь сделать это с помощью плагина https://ru.wordpress.org/plugins/custom-css-js/
вставляю в окно
/* Add your JavaScript code here.

If you are using the jQuery library, then don't forget to wrap your code inside jQuery.ready() as follows:

jQuery(document).ready(function( $ ){
    // Your code in here
});

--

If you want to link a JavaScript file that resides on another server (similar to
<script src="https://example.com/your-js-file.js"></script>), then please use
the "Add HTML Code" page, as this is a HTML code that links a JavaScript file.

End of comment */ 
  
document.addEventListener('click', function(evt){
	if (evt.target.classList.contains('pew'))
  evt.preventDefault()
  zzz.innerHTML = `<img src="${evt.target.href}">`
  zzz.style.display = 'block'
})

Получается ерунда,
copy.selftrips.ru/category/1

Как правильно вставлять JS?
  • Вопрос задан
  • 141 просмотр
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы