「periodType」という名前のラジオ ボタンのグループがあります。そのグループには、追加の div を表示するという事実を除いて、他のボタンと同じように動作するラジオ ボタンが 1 つあります。以下の変更機能は、グループ内のすべてのラジオ ボタンに対して非常に一般的であるため、その特定のラジオ ボタンがいつチェックされているかを知るにはどうすればよいですか。
$('input[name="periodType"]').change(function() {
if(this.checked) {
//do something (for all radio buttons)
//If unique radio button also do this
}
});
<input type="radio" name="periodType" default>
<input type="radio" name="periodType" default>
<input type="radio" name="periodType" default>
<input type="radio" name="periodType" default>