2012-07-30 8 views
5

Używam jQuery 1.3.2 ale mam zaktualizowany do najnowszej wersji:

Poniższa nie działa z najnowszą wersją jQuery - co tu jest nie tak?

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') + ']'); 

Odpowiedz

10

spróbuj zmienić ostatnią linię do tego:

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

dzięki zadziałało :) – user1177860

+0

Oznacz jako odpowiedź zaakceptowana następnie :) –

+1

Niż! Uratowałeś mi trochę czasu. Od wersji 1.8.0 wymagane są podwójne cytaty ... – nightcoder

Powiązane problemy