GithubHelp home page GithubHelp logo

html-forms's Introduction

Домашнее задание к лекции «Работа с HTML-формами»

Выполните задачи:

  1. Текстовый чат.
  2. Дерево интересов.
  3. Выпадающий список с поиском.

Чтобы получить зачёт, выполните все три задачи. Пришлите на проверку все три задачи сразу, не частями.

Работы должны соответствовать принятому стилю оформления кода.

Любые вопросы по задачам задавайте в чате учебной группы.

Бонус

У большинства полей ввода, помимо событий и свойств, есть методы, программно вызывающие те или иные события. Прочитайте статью о свойствах по каждому элементу: Формы и javascript. FORM.

Собственные события

Обратите внимание, что некоторые обработчики событий вы можете вызывать вручную, например blur(), focus().

HTML-формы

На MDN (Mozilla Developer Network) есть цикл статей о HTML-тегах элементов форм: Руководство по HTML-формам.

Также посмотрите про способы навигации по элементам формы, которые имеют атрибуты name: Навигация и свойства элементов формы.

:checked

В CSS есть псевдоселектор :checked, который позволяет получать только отмеченные элементы:

<input type="checkbox" checked name="interests[]" class="interest">
<input type="checkbox" value="Коты" name="interests[]" class="interest">
<input type="checkbox" checked value="Собаки" name="interests[]" class="interest">
const selectedInterests = document.querySelectorAll( '.interest:checked' );

Такой подход извлечёт только нужные элементы, в то время как более «дедовский»

const selectedInterests = [...document.querySelectorAll( '.interest' )]
  .filter( el => el.checked );

извлечёт все и только потом отфильтрует выбранные.

html-forms's People

Contributors

luklena avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.