67
59

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2013-07-11

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

<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 追記] サービス終了によりデモは利用できなくなりました。

67
59
10

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
67
59

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?