1

У меня возникла ошибка в Js Uncaught TypeError: $ is not a function

<script>
    function checkParams(event) {
        var name = $('#name').val();
        var email = $('#email').val();

        if(name.length != 0 && email.length != 0 ) {
            console.log('1');
        } else {
            console.log('2');
        }
     }      
 </script>

    <form enctype="multipart/form-data" id="form_newdead" method="POST">
        <input  type="text" name="name"  placeholder="Как вас зовут?"autocomplete="off"  id="name"  onkeyup="checkParams(event);">

        <input  id="email" type="text" name="email""autocomplete="off" placeholder="Ваш Email"  
            onkeyup="checkParams(event);">
</form>
1
  • 3
    Надо подключить jQuery. 16 мая 2020 в 7:08

2 ответа 2

1

Действительно, как заметили выше, необходимо подключить jQuery, чтобы код сработал.

1

в < head > документа пропишите

<script
  src="http://code.jquery.com/jquery-3.5.1.js"
  integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
  crossorigin="anonymous"></script>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.