【发布时间】:2015-03-15 00:07:02
【问题描述】:
我一直在我的控制台日志中收到此消息(仅适用于 chrome):
Uncaught SyntaxError: Unexpected token
它在 Firefox 上运行良好。
我做了一些研究,它说 Chrome 不支持命名参数。但是我在发现错误的第 131 行没有任何命名参数。
下面是我正在使用的代码。任何帮助将不胜感激!
var id = checkbox_element.attr('id');
var recurring_cycle_dropdown = $("#recurring_cycle");
var label = $("label#" + id);
//Display the radio options pricing method when the payment type checkbox has been checked
if (checkbox_element.is(":checked")) {
/*If the checkbox id is recurring show the recurring cycle right
* after the label next to the radio button, */
if(id == "recurring"){
label.after(recurring_cycle_dropdown.show(0, function(){
//The $(this) is referring to the recurring_cycle_dropdown
//not the checkbox
$(this).css("display","block");
//****THIS IS THE LINE WHERE THE ERROR IS FOUND****
$(this).prop("disabled",false);
}));
}
【问题讨论】:
-
我没有发现任何明显的问题。 (
id应该是唯一的,因此您的标签和复选框不应使用彼此相同的 id,但这对于显示的代码无关紧要。)
标签: javascript jquery