LoginSignup
0
0

More than 5 years have passed since last update.

チェックをすると値をテキストエリアに自動入力(備忘録)

Last updated at Posted at 2016-12-27
index.html
<input tyep="checkbox" value="1" id="check" />
<textarea name="hoge" id="post">
javascript.js
$("input[name='checkbox']:checkbox").on('click',function() {
        var array = new Array();
        $("input[name='checkbox']:checked").map(function() {
            array.push($(this).val());
        });
        $("#post").text(array.toString());
    });

チェックした値をテキストエリアに配列で入れてくれます。

0
0
0

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
0
0