The goal is to make these codes work.At this stage, there is no problem if you allow certain tags to disappear.
If possible, we would like to add additional registration function to the button that disappears the tag.
★For convenience, we created bundle.js in the link below, and we have deleted the description as the problem has become more multifaceted this time.
Also, bundle.js alone works.
https://qiita.com/dsk_datadog/items/6dfc55f35db24614107d
If there is any solution, please take care of it.
References currently in reference
https://dojotoolkit.org/documentation/tutorials/1.10/modern_dojo/index.html
https://dojotoolkit.org/documentation/tutorials/1.10/modern_dojo/demo/modern_dojo-parser.html
https://qiita.com/dsk_datadog/items/6dfc55f35db24614107d
https://dojotoolkit.org/documentation/tutorials/1.10/dom_functions/index.html
https://gis.stackexchange.com/questions/182364/uncaught-typeerror-cannot-read-property-on-of-undefined
https://dojotoolkit.org/documentation/tutorials/1.10/using_query/index.html
Error Message
Uncaught TypeError: Cannot read properties of undefined (reading 'on')
atl(dojo.js.uncompressed.js:8613:13)
at index.html:45:6
atja(dojo.js.uncompressed.js:1164:35)
at dojo.js.uncompressed.js:1330:6
atka(dojo.js.uncompressed.js:1307:5)
ata(dojo.js.uncompressed.js:1325:4)
atr(dojo.js.uncompressed.js:1492:7)
at HTMLScriptElement.<anonymous>(dojo.js.uncompressed.js:1745:20)
button.png:1 Failed to load resource:net::ERR_FILE_NOT_FOUND
demo.css
*{
outline: none!important;
}
body{
margin:0;
padding:2em;
font-family: Lucida Sans, Lucida Grande, Arial!important;
font-size: 13px!important;
background:white;
color:#333;
}
button {
- webkit-transition:background-color 0.2s linear;
border-radius:4px;
- moz-border-radius: 4px4px4px4px;
-moz-box-shadow:01px1pxrgba(0,0,0,0.15);
background-color:#E4F2FF;
background-image:url("//ajax.googleapis.com/ajax/libs/dojo/1.7.4/dijit/themes/claro/form/images/button.png");
background-position:center top;
background-repeat —repeat-x;
border —1px solid#769DC0;
padding —2px8px4px;
font-size:1em;
}
button:hover {
background-color:#AFD9FF;
color:#000000;
}
h1{
font-size: 1.5em;
}
.break
{
float: none;
clear —both;
}
index.html
<!DOCTYPE html>
<html lang="ja">
<head>
<metacharset="UTF-8"/>
<title>Web SQL Database</title>
<link rel="stylesheet" href="demo.css" media="screen" type="text/css">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.13.0/dijit/themes/claro/claro.css"media="screen">
</head>
<body class="claro">
<input type="text" name="todo"/>
<Button data-dojo-type="dijit/form/Button" type="Button" name="register" id="Button1">
<span>Register>/span>
</button>
<table id="table">
<thead>
<tr>
<span id="test">No Todo</span>
<th>/th>
<th>/th>
</tr>
</thead>
<tbody>
<!--Add TODO-->
</tbody>
</table>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.13.0/dojo/dojo.js" data-dojo-config="isDebug:1, async:1, parseOnLoad:1">/script>
<script>
require(["dojo/parser", "dojo/dom", "dojo/dom-construct", "dojo/on", "dijit/registry", "dijit/form/Button", "dojo/domReady!", function(parser, dom, domConstruct, on, registry) {
var myClick=function(evt){
vartest=dom.byId("test");
domConstruct.empty("test");
};
on(registry.byId("button1"), "click", myClick);
parser.parse();
});
</script>
</body>
</html>
on(registry.byId("button1"), "click", myClick);
parser.parse();
Note that parser.parse()
in dojo/parser
creates a Widget with data-dojo-type
.The previous line has not yet run parser.parse()
, so the button1
Widget has not been created, and of course it cannot be retrieved in registry.byId()
.
parser.parse().then(function(){
on(registry.byId("button1"), "click", myClick);
});
How about waiting for and parser.parse()
to complete?
I missed one more point.
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.13.0/dojo/dojo.js" data-dojo-config="isDebug:1, async:1, parseOnLoad:1"></script>
dojo/parser
, but
data-dojo-config="parseOnLoad:1"
.parser.parse()
.I don't know the exact behavior, but the two executions seem to be competing.As mentioned earlier, I would like to run on()
after completing parser.parse()
, so how about setting it to parseOnLoad:false
and parser.parse()
only?
© 2024 OneMinuteCode. All rights reserved.