gpt4 book ai didi

jquery对话框错误: Expected identifier,字符串或数字

转载 作者:行者123 更新时间:2023-12-01 06:01:11 25 4
gpt4 key购买 nike

我从 jquery 对话框中收到一条错误消息:

Error: Expected identifier, string or number.

错误消息指向带有 buttons: { 声明的行。知道什么可能导致问题吗?

$(document).ready(function(){


var $dialog = $('<div></div>').html('<form id="myform" action=""><input type="checkbox" id="completeCheck" name="completeCheck" value="" />Completeness check<br /><input type="checkbox" name="viewUnofficial" value="Car" /> View unofficial status <br /><input type="checkbox" name="consist" value="" />Consistency<br /><input type="checkbox" name="otherData" value="" />Other checks<br /><input type="checkbox" name="keyCheck" value="" />Key check<br /><input type="checkbox" name="compareVersions" value="" />Compare versions<br /></form>').dialog({
autoOpen: false,
title: 'Select data check',
buttons: {
"Submit Form": function () {
$('form#myform').submit();
},
"Cancel": function () {
$(this).dialog("close");
}
}
});

});

最佳答案

代码的工作演示 http://jsfiddle.net/ta7QY/

随意尝试演示; $('div') 和我还通过单击链接实例化了对话框。其余代码如下。

这会有所帮助,:)

代码

$("#forgot").click(function(e){ 
$dialog.dialog("open");
e.preventDefault();
});


var $dialog = $('<div>')
.html('<form id="myform" action=""><input type="checkbox" id="completeCheck" name="completeCheck" value="" />Completeness check<br /><input type="checkbox" name="viewUnofficial" value="Car" /> View unofficial status <br /><input type="checkbox" name="consist" value="" />Consistency<br /><input type="checkbox" name="otherData" value="" />Other checks<br /><input type="checkbox" name="keyCheck" value="" />Key check<br /><input type="checkbox" name="compareVersions" value="" />Compare versions<br /></form>')
.dialog({
autoOpen: false,
title: 'Select data check',
buttons: {
"Submit Form": function() { $('form#myform').submit();},
"Cancel": function() {$(this).dialog("close");}
}
});

脚本

  <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css">

<link rel="stylesheet" type="text/css" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css">

<script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>

关于jquery对话框错误: Expected identifier,字符串或数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11328716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com