Re:美しいプログラムを書く(業務用Webアプリケーション保守編) ネタ元:美しいプログラムを書く(業務用Webアプリケーション保守編) 僕だったらこう書くかな。 $(function(){ //set obj var newInput = $("input[name='new_version']"); var oldInput = $("input[name='old_version']"); //init newInput.eq(0).attr('checked','checked'); oldInput.eq(0).attr('checked','checked'); //set event newInput.change(function () { var index = newInput.index(this); oldInput.eq(index).attr('checked'
![Re:美しいプログラムを書く(業務用Webアプリケーション保守編)](https://cdn-ak-scissors.b.st-hatena.com/image/square/a9717624309e36a795026e1b70982163687ccca2/height=288;version=1;width=512/https%3A%2F%2Fblog.webcreativepark.net%2Ficon_200x200.png)