I had trouble implementing this W3 tutorial on creating a draggable <div> object into a project of mine earlier, so I thought I'd try it out with a blank Twine story. I pasted the HTML as-is into a passage, pasted the CSS into my Story Stylesheet, and pasted the Javascript into the Story Javascript, but was met with
Error [tw-user-script-0]: Cannot read property 'id' of null.
Placing the Javascript into a <<script>> macro underneath the HTML returned the same error. However, copying the Javascript into a <script> tag executed the code properly.
I am unsure if this is a bug or not; if it is not, an explanation of the difference between the Twine <<script>> macro and HTML <script> tag's execution of Javascript would be greatly appreciated.
I had trouble implementing this W3 tutorial on creating a draggable
<div>
object into a project of mine earlier, so I thought I'd try it out with a blank Twine story. I pasted the HTML as-is into a passage, pasted the CSS into my Story Stylesheet, and pasted the Javascript into the Story Javascript, but was met withPlacing the Javascript into a
<<script>>
macro underneath the HTML returned the same error. However, copying the Javascript into a<script>
tag executed the code properly. I am unsure if this is a bug or not; if it is not, an explanation of the difference between the Twine<<script>>
macro and HTML<script>
tag's execution of Javascript would be greatly appreciated.macOS Twine 2.2.1, Sugarcube 2.25.0