Jquery单选按钮重复

时间:2016-04-11 13:08:34

标签: javascript jquery html

@Pipe({
  name: 'orderByProperty'
})
export class OrderByPropertyPipe {
  transform(value, args) {
    var sortedArray = value.slice();

    if (!args[0]) {
      return sortedArray;
    } else if (sortedArray) {
      return sortedArray.sort(function(a,b) {
        return (a[args[0]] > b[args[0]]) ? 1 : 
               ((b[args[0]] > a[args[0]]) ? -1 : 0);
      });
    }
  }
}

这是我的javascript代码

<div class="boxanswer"><input type="radio" name="idquestion[2]" value="2" class="checkradios"><span class='answer_choice'>A . 1</span></div>
<div class="boxanswer"><input type="radio" name="idquestion[2]" value="2" class="checkradios"><span class='answer_choice'>B. 2</span></div>
<div class="boxanswer"><input type="radio" name="idquestion[2]" value="3" class="checkradios"><span class='answer_choice'>C. 3</span></div>
<div class="boxanswer"><input type="radio" name="idquestion[2]" value="4" class="checkradios"><span class='answer_choice'>D. 4</span></div>
<div class="boxanswer"><input type="radio" name="idquestion[2]" value="5" class="checkradios"><span class='answer_choice'>E. 5</span></div>

每次我选中其中一个单选按钮时,我都会收到6个警告框,而不是1个警报。我的代码出了什么问题?

0 个答案:

没有答案