LoginSignup
1
3

More than 1 year has passed since last update.

JqueryとHTML手抜き用メモ。

Last updated at Posted at 2021-11-04

JqueryとHTML手抜き用メモ。

・minの値を入力するとmaxの値を補完
・値無しにチェックしたら値ありを無効化

ここにプラグインのやつほしいなぁ。

未検証
<p>値無し<input type="checkbox" id=avg value=""></p>
値あり
<input id="avg-min" type="text" value=""><input id="avg-max" type="text" value="">

<script>
$('#min').on('change', function () {
    var min = $(this).val();
    $('#min').val(max);
});

$(document).on('click', '#avg', function(){
    var checked = $('#avg').prop('checked');
            $('#avg-min').prop('disabled', checked);
            $('#avg-max').prop('disabled', checked);
});
</script>

@juner さんより最後の2行の引数の誤記の指摘をいただきました。
無茶苦茶ありがとうございます。

1
3
2

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
1
3