Как через Jquery установить атрибут checked?

Как через Jquery установить тегу input атрибут checked?
Мой тестовый вариант. Я пытаюсь всем input установить атрибут checked: $('input').attr( "checked" );
  • Вопрос задан
  • 263 просмотра
Решения вопроса 1
.prop

Properties generally affect the dynamic state of a DOM element without changing the serialized HTML attribute. Examples include the value property of input elements, the disabled property of inputs and buttons, or the checked property of a checkbox. The .prop() method should be used to set disabled and checked instead of the .attr() method.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

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

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