我试图让 autoComplete() 从 jQuery-ui 工作。我创建了一个小提琴来显示我的代码:
https://jsfiddle.net/4s4dzwn1/
我的JS:
jQuery(function(){
jQuery('#autocomplete').autoComplete({
source: ["ActionScript",
"Bootstrap",
"C",
"C++",
"Ecommerce",
"Jquery",
"Groovy",
"Java",
"JavaScript",
"Lua",
"Perl",
"Ruby",
"Scala",
"Swing",
"XHTML"]
});
});
Run Code Online (Sandbox Code Playgroud)
我的 HTML:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<form>
<input id="autocomplete">
</form>
Run Code Online (Sandbox Code Playgroud)
它抛出一个错误,说 autoComplete 不是一个函数。我的理解是 autoComplete 是 jQuery-ui(包含在内)的一部分,并且 jQuery-ui 应该在jquery之后包含。请纠正我的错误。
我在jquery UI中使用draggable,我想知道UI参数有什么,因为我想知道调用stop()回调函数的句柄位置.
然后我想设置一个值来将draggable移动到特定位置.知道了,我该如何设置值(如滑块).http://jqueryui.com/demos/slider/#option-value
谢谢,
我需要一些帮助.
在我的生活中,我不能想到这一点.我头上缠着它只是无济于事.
我想设置两个功能.
function:select_date()与用户交互以从jQuery Date选择器中选择日期.如果对话框已关闭,则返回null.
然后是第二个功能:test()检查日期是否是picked/selected.
这是我的困境,当test()执行该功能时,会弹出一个警告框并说明"undefined"这意味着,我永远不会选择一个日期而且它始终存在"undefined"
我不明白我在这里做错了什么,一切对我来说都是合乎逻辑的.
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.js"></script>
<script type="text/javascript">
function select_date() {
var sdate
$('#dd').dialog({
autoOpen: true,
modal: true,
overlay: {
opacity: 0.5,
background: 'black'
},
title: "title",
height: 265,
width: 235,
draggable: false,
resizable: false
});
$('#d1').datepicker({
onSelect: function () {
$("#dd").dialog("close");
}
});
return sdate
}
function test() {
var x …Run Code Online (Sandbox Code Playgroud) 我使用以下代码获得了一个Unxepected Identifier编辑器.我整天都在排它故障,什么都没有.希望一双新鲜的眼睛可以发现我的错误.我正在尝试使用jQuery UI来设置日期选择器,然后获取并操纵日期.更改选择器上的日期应通过ajax更改与该日期关联的页面上的图像.
$(document).ready(function(){
// Datepicker
$('#datepicker').datepicker({
dateFormat: 'yy-mm-dd',
inline: true,
minDate: new Date(2012, 06 - 1, 1),
maxDate:new Date(2012, 09 - 1, 31),
onSelect: function(){
var day1 = ($("#datepicker").datepicker('getDate').getDate()).toString().replace(/(^.$)/,"0$1");
var month1 = ($("#datepicker").datepicker('getDate').getMonth() + 1).toString().replace(/(^.$)/,"0$1");
var year1 = $("#datepicker").datepicker('getDate').getFullYear();
var fullDate = year1 + "/" + month1 + "/" + day1;
var dashDate = year1 + "-" + month1 + "-" + day1;
var str_output = "<a id=\"single_image\" href=\"http://www.lasalle.edu/150/dayinhistory/" + fullDate + ".jpg\" title=\"\"><img src=\"http://www.lasalle.edu/scripts/timthumb/timthumb.php?src=http://www.lasalle.edu/150/dayinhistory/" + fullDate + ".jpg&w=560&h=350&zc=1&a=t\">"; …Run Code Online (Sandbox Code Playgroud) 我正在使用这个jquery-ui来显示一个对话框,但它带有一个名为"close"的freebee,我不想要它,
你可以在这里找到其余的代码,为什么我的对话框不起作用
在html中它的出现
<a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button">
<span class="ui-icon ui-icon-closethick">close</span>
</a>
Run Code Online (Sandbox Code Playgroud) 我在选择单击的 ID 内的 ap 标签时遇到一些问题,代码如下;
Run Code Online (Sandbox Code Playgroud)<tbody> <tr id="test1"> <p> Some random text that should show up in the dialog. </p> <td>test</td> <td>test</td> </tr> ... the rest of the tr's are identical, nothing else to see here. </tbody> $('#test1, #test2, #test3, #test4').click(function(){ $(this 'p').dialog(); });
现场测试;http://team-blandsaft.no-ip.org/
最好习惯在 stackoverflow 编辑器中编写一些代码。
我需要在关闭jquery ui对话框时执行一些脚本.jquery对话框是否有一个'close'事件,我可以添加一个处理程序来执行我的脚本?如果它存在,请你告诉我如何用一个例子来做
我在网站上运行了一个 jQuery UI 日期选择器,其中仅根据之前的下拉选择启用了某些日期(我使用 MySQL 查询来获取整年的日期)。收到日期后,它会传递给日期选择器,并且仅启用这些日期。我已经实现了所需的行为,但问题是当我获取整年的日期时,MySQL 查询需要很长时间才能获取日期。
我现在想要实现的是查询前 3 个月的日期并在 datepicker 上启用它们,一旦用户导航到接下来 3 个月的第 3 个月查询并在 datepicker 中设置日期。这样我就不会对数据库施加压力,而且日历加载速度也会更快。
这可能吗?
代码很长,我发布了启用/禁用日期的部分:
var datepickerDateFilter = function (date) {
var month = date.getMonth() + 1;
var day = date.getDate();
var date_string = date.getFullYear() + '-' + (month < 10 ? '0' : '') + month + '-' + (day < 10 ? '0' : '') + day;
if ($courseDates.length > 0 && $.inArray(date_string, $courseDates) != -1) {
return [true];
}
return [false];
}; …Run Code Online (Sandbox Code Playgroud) 我正在尝试,但是切换不工作最后我筋疲力尽,把问题放在这里我知道它幼稚,但请帮助我.
<script type="text/javascript">
$(document).ready(function(){
$(".nature_property").change(function(){
var nature_property_id = $(".nature_property").val();
switch(nature_property_id){
case nature_property_id == 1:
$("#appartment").css("display", "block");
break;
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud) 我正在寻找一种方法,允许用户通过按ESC键取消鼠标拖动操作.
可以使用Javascript完成吗?
谢谢
更新
当鼠标在可放置区域上拖动div元素时,按ESC键应将元素拖动到不可放置的区域.将元素拖动到不可放置的区域后,我会在拖动的元素上调用"mouseup"事件,这会导致拖动的元素被拖放到不可放置的区域.
我怎么能用jQuery Draggable和jQuery Droppable做到这一点?
jquery-ui ×10
jquery ×9
javascript ×5
html ×3
ajax ×1
autocomplete ×1
dialog ×1
draggable ×1
syntax-error ×1