Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
58
Help us understand the problem. What is going on with this article?
@otchy

よくある全選択チェックボックス jQuery 実装

More than 1 year has passed since last update.

こちらにインスパイアされました。

<ul>
    <li><label><input type="checkbox" id="all" /> Check all</label></li>
    <li><label><input type="checkbox" name="check" value="1" /> value 1</label></li>
    <li><label><input type="checkbox" name="check" value="2" /> value 2</label></li>
    <li><label><input type="checkbox" name="check" value="3" /> value 3</label></li>
    <li><label><input type="checkbox" name="check" value="4" /> value 4</label></li>
</ul>
$('#all').on('change', function() {
    $('input[name=check]').prop('checked', this.checked);
});

デモ
[2020-05-03 追記] サービス終了によりデモは利用できなくなりました。

58
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
otchy
1979 年 2 月 10 日生まれ / 仕事: Web システム開発 / 好きなもの: IT 全般、科学分野 / 座右の銘: 明日は明日の風が吹く / 好きな言葉: ハードルは高ければ高いほどくぐりやすい

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
58
Help us understand the problem. What is going on with this article?