`uncaught SyntaxError:Unexpected token)`根据Chrome的控制台

时间:2012-06-02 14:31:29

标签: javascript jquery syntax syntax-error

这个结束括号意外是什么?

function pollCreateOptions_addOption ()
{ // Opening of curly bracket 1
    var highestN = 0;

    $('table#options tr td fieldset').each
    ( // Opening of normal bracket 1
        function (i, option)
        { // Opening of curly bracket 2
            alert (this.attr ('name'));
        { // Closing of curly bracket 2
    ); // Closing of normal bracket 1
} // Closing of curly bracket 1

2 个答案:

答案 0 :(得分:1)

$('table#options tr td fieldset').each
    ( 
        function (i, option)
        { 
            alert (this.attr ('name'));

        } // not {
    );

答案 1 :(得分:1)

您应该使用结束}而不是在此处打开{{ // Closing of curly bracket 2

function pollCreateOptions_addOption ()
{ // Opening of curly bracket 1
    var highestN = 0;

    $('table#options tr td fieldset').each
    ( // Opening of normal bracket 1
        function (i, option)
        { // Opening of curly bracket 2
            alert (this.attr ('name'));
        } // Closing of curly bracket 2
    ); // Closing of normal bracket 1
} // Closing of curly bracket 1