jquery - 语法错误,无法识别的表达式 : [name=ctl00$MainContent$mainProgress]

标签 jquery

我使用的是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') + ']');

最佳答案

尝试将最后一行更改为:

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

关于jquery - 语法错误,无法识别的表达式 : [name=ctl00$MainContent$mainProgress],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11722160/

相关文章:

javascript - 我们可以在 javascript/jquery 中将 "e"从一个函数传递到另一个函数吗?

javascript - 谷歌地图 : change from map view to satellite view

javascript - 需要点击2次才能激活jquery功能,然后点击1次

javascript - 未定义函数初始化 taginput bootstrap 3

javascript - 拖动 anchor 绑定(bind) ‘mousedowd, mousemove, mouseup’时如何防止重定向?

javascript - jquery多选,如何从函数而不是更改事件中获取值

javascript - 如何从下拉列表中选择多个值?我使用的是 Bootstrap css 版本 3

javascript - 如何从一个jsp页面到另一个jsp页面获取select标签中给出的值

javascript - 使用 jQuery 上传非拉丁名称文件

javascript - 当我单击 div 时,div 应该刷新并且应该显示刷新的数据