6

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

1 に答える 1

11

最後の行を次のように変更してみてください。

var allInputs = $('input[name="' + input.attr('name') + '"]');
于 2012-07-30T13:03:19.670 に答える