admin管理员组文章数量:1026989
I was practicing with data picker in jQuery UI and I got into problem that I could't solve.
I wanted to calculate the difference of given date (from date picker) and today's date in days, after user clicked calculate button.
I get this error:
Uncaught ReferenceError: select is not defined(anonymous
function)
j
k.fireWithjQuery.js: 2
m.extend.readyjQuery.js: 2
J
Here is my code:
$(document).ready(function() {
$("#calculate").click(function() {
var d1 = $(".date-pick").datepicker("setDate", new Date());
var d2 = $("#startDate").datepicker('getDate');
var diff = 0;
if (d1 && d2) {
diff = Math.floor((d2.getTime() - d1.getTime()) / 86400000);
}
$('#calculated').val(diff);
});
$("#startDate").datepicker({
onSelect: select
});
});
Here is my plete source code
I was practicing with data picker in jQuery UI and I got into problem that I could't solve.
I wanted to calculate the difference of given date (from date picker) and today's date in days, after user clicked calculate button.
I get this error:
Uncaught ReferenceError: select is not defined(anonymous
function)
j
k.fireWithjQuery.js: 2
m.extend.readyjQuery.js: 2
J
Here is my code:
$(document).ready(function() {
$("#calculate").click(function() {
var d1 = $(".date-pick").datepicker("setDate", new Date());
var d2 = $("#startDate").datepicker('getDate');
var diff = 0;
if (d1 && d2) {
diff = Math.floor((d2.getTime() - d1.getTime()) / 86400000);
}
$('#calculated').val(diff);
});
$("#startDate").datepicker({
onSelect: select
});
});
Here is my plete source code
Share Improve this question asked Jan 13, 2015 at 18:46 Node.JSNode.JS 1,6347 gold badges55 silver badges131 bronze badges 1-
5
It's not defined because you didn't define it anywhere, you just randomly typed
select
as a value in an object, and there's no variable namedselect
in your code. – adeneo Commented Jan 13, 2015 at 18:47
1 Answer
Reset to default 4You simply have not defined select
function anywhere in your source code (all your custom js-code is currently in your index.html, so it is easy to figure it out), but you are trying to use it as onSelect
event handler.
I was practicing with data picker in jQuery UI and I got into problem that I could't solve.
I wanted to calculate the difference of given date (from date picker) and today's date in days, after user clicked calculate button.
I get this error:
Uncaught ReferenceError: select is not defined(anonymous
function)
j
k.fireWithjQuery.js: 2
m.extend.readyjQuery.js: 2
J
Here is my code:
$(document).ready(function() {
$("#calculate").click(function() {
var d1 = $(".date-pick").datepicker("setDate", new Date());
var d2 = $("#startDate").datepicker('getDate');
var diff = 0;
if (d1 && d2) {
diff = Math.floor((d2.getTime() - d1.getTime()) / 86400000);
}
$('#calculated').val(diff);
});
$("#startDate").datepicker({
onSelect: select
});
});
Here is my plete source code
I was practicing with data picker in jQuery UI and I got into problem that I could't solve.
I wanted to calculate the difference of given date (from date picker) and today's date in days, after user clicked calculate button.
I get this error:
Uncaught ReferenceError: select is not defined(anonymous
function)
j
k.fireWithjQuery.js: 2
m.extend.readyjQuery.js: 2
J
Here is my code:
$(document).ready(function() {
$("#calculate").click(function() {
var d1 = $(".date-pick").datepicker("setDate", new Date());
var d2 = $("#startDate").datepicker('getDate');
var diff = 0;
if (d1 && d2) {
diff = Math.floor((d2.getTime() - d1.getTime()) / 86400000);
}
$('#calculated').val(diff);
});
$("#startDate").datepicker({
onSelect: select
});
});
Here is my plete source code
Share Improve this question asked Jan 13, 2015 at 18:46 Node.JSNode.JS 1,6347 gold badges55 silver badges131 bronze badges 1-
5
It's not defined because you didn't define it anywhere, you just randomly typed
select
as a value in an object, and there's no variable namedselect
in your code. – adeneo Commented Jan 13, 2015 at 18:47
1 Answer
Reset to default 4You simply have not defined select
function anywhere in your source code (all your custom js-code is currently in your index.html, so it is easy to figure it out), but you are trying to use it as onSelect
event handler.
本文标签: javascriptselect is not definedjQuery UIStack Overflow
版权声明:本文标题:javascript - select is not defined, jQuery UI - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1744364755a2093547.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论