jQuery)SyntaxError:missing:属性id之后)

时间:2013-08-02 11:50:36

标签: javascript jquery

我的页面中有一些jQuery不断给出错误:

SyntaxError: missing : after property id

代码

        <div id='content1'  >
<script type="text/javascript">
    $(document).ready(function () {
        var theme = getDemoTheme();
        var source = [
            "Suppliers",
            "Global Networks",
            "Supplier Networks",
            "Supplier Prices",
            "Supplier Data Import",
            "Supplier Target Price Export"
        ];
        // Create a jqxDropDownList
        $("#jqxWidget1").jqxDropDownList({ source: source, selectedIndex: 0, width: '200',margin-top:'0px', height: '25', theme: theme });
    });
</script>
<div id='jqxWidget1'>
</div>

Firebug说这是在这条线上:

1 个答案:

答案 0 :(得分:3)

在传递给jqxDropDownList的json选项中,您有一个键margin-top,因为它有一个-,它必须包含在""

尝试

$("#jqxWidget1").jqxDropDownList({ source: source, selectedIndex: 0, width: '200',"margin-top":'0px', height: '25', theme: theme });