2012-07-30 12 views
5

私はjQueryの1.3.2を使用していますが、私は、最新バージョンに更新している:以下はjqueryのの最新バージョンでは動作しません

- 何がここで間違っているのですか?

var input = $(this); 

      // get the associated label using the input's id 
      var label = $('label[for=' + input.attr('id') + ']'); 

      //get type, for classname suffix 
      var inputType = (input.is('[type=checkbox]')) ? 'checkbox' : 'radio'; 

      // wrap the input + label in a div 
      $('<div class="custom-' + inputType + '"></div>').insertBefore(input).append(input, label); 

      // find all inputs in this set using the shared name attribute 
      var allInputs = $('input[name=' + input.attr('name') + ']'); 

答えて

10

これに最後の行を変更してみてください:

var allInputs = $('input[name="' + input.attr('name') + '"]'); 
+0

おかげで、それは:) – user1177860

+0

マークの答えを働いた後、受け入れ:) –

+1

ありがとうとして!あなたは私にいくつかの時間を救った。バージョン1.8.0から二重引用符が必要になりました... – nightcoder

関連する問題