1. ホーム
  2. JQuery

Uncaught TypeError: 未定義のプロパティ 'length' を読み取れませんでした。

2022-02-10 13:47:13

<スパン 1. エラーの内容


jquery.easyui.min.js:8311 Uncaught TypeError: Cannot read property 'length' of undefined
    at _5ce (jquery.easyui.min.js:8311)
    at show (jquery.easyui.min.js:8375)
    at HTMLDivElement.<anonymous> (jquery.easyui.min.js:8463)
    at Function.each (jquery.min.js:2)
    at m.fn.init.each (jquery.min.js:2)
    at m.fn.init.$.fn.calendar (jquery.easyui.min.js:8450)
    at HTMLDivElement.<anonymous> (jquery.easyui.min.js:8483)
    at Function.each (jquery.min.js:2)
    at m.fn.init.each (jquery.min.js:2)
    at Object.moveTo (jquery.easyui.min.js:8474)
_5ce @ jquery.easyui.min.js:8311
show @ jquery.easyui.min.js:8375
(anonymous) @ jquery.easyui.min.js:8463
each @ jquery.min.js:2
each @ jquery.min.js:2
$.fn.calendar @ jquery.easyui.min.js:8450
(anonymous) @ jquery.easyui.min.js:8483
each @ jquery.min.js:2
each @ jquery.min.js:2
moveTo @ jquery.easyui.min.js:8474
$.fn.calendar @ jquery.easyui.min.js:8447
_b32 @ jquery.easyui.min.js:14962
onShowPanel @ jquery.easyui.min.js:14870
onOpen @ jquery.easyui.min.js:13194
cb @ jquery.easyui.min.js:3144
9 @ jquery.easyui.min.js:3134
(anonymous) @ jquery.easyui.min.js:3372
each @ jquery.min.js:2
each @ jquery.min.js:2
open @ jquery.easyui.min.js:3371
$.fn.panel @ jquery.easyui.min.js:3329
_a05 @ jquery.easyui.min.js:13324
(anonymous) @ jquery.easyui.min.js:13481
each @ jquery.min.js:2
each @ jquery.min.js:2
showPanel @ jquery.easyui.min.js:13480
$.fn.combo @ jquery.easyui.min.js:13441
_9f8 @ jquery.easyui.min.js:13241
handler @ jquery.easyui.min.js:13209
(anonymous) @ jquery.easyui.min.js:6920
dispatch @ jquery.min.js:4
r.handle @ jquery.min.js:4



<スパン 2. エラーの理由

<スパン

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>switch-case statement control function return value</title>
		<link rel="stylesheet" href="... /css/themes/black/easyui.css" />
		<link rel="stylesheet" href=". /css/themes/icon.css" />
		<link rel="stylesheet" href=". /css/demo.css" />
		<script type="text/javascript" src=". /js/jquery.min.js" ></script>
		<script type="text/javascript" src=". /js/jquery.easyui.min.js" ></script>
		<script>
			$(function(){
				$("#monthDate").datebox({
					formatter: function(date){ 
						return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate(); 
					},
        			parser: function(date){ 
        				return new Date(Date.parse(date.replace(/-/g,"/"))); 
        			}
				});
			});
			
			function dateFormatter(date){
		        return (date.getMonth() + 1);
		    }
		</script>
	</head>
	<body>
		<div>
			<input id="monthDate" class="easyui-datebox" labelPosition="top"><br><br>
			<input type="text" id="month" /><br><br>
			<button>Get month dynamically</button>
		</div>
	</body>
</html>




<スパン 3. ソリューション