javascript - jQuery ) 语法错误 : missing : after property id)

标签 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 说它在这一行:

最佳答案

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

尝试

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

关于javascript - jQuery ) 语法错误 : missing : after property id),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18016214/

相关文章:

jquery - 如何从文本输入框中删除空格

javascript - JQuery 过滤函数忽略 html 元素并只搜索文本

javascript - jQuery:在 .contents() 内排序

javascript - 类型错误 : a is null

php - 如何创建 jquery 函数来防止向数据库重复输入

javascript - 使用 img.src 将 img.onload 链接到 Image() 对象

javascript - 从数组组中删除多个对象

javascript - 将动画滚动与另一个 ahref 函数一起使用

php - 为什么不在这里使用 POST 方法?

javascript - 页面完全加载后,如何使用 JavaScript 在浏览器的地址栏中写入内容?