• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to reference the HTML DOM using Animate Canvas.

Participant ,
Dec 20, 2023 Dec 20, 2023

Copy link to clipboard

Copied

How do I use something like

 

document.getElementByName();

 

using javascript.  

 

I get an error in the Javascript console on Safari

TypeError: undefined is not an object

 

Got it.   Load it up to server.   Doesn't work on local envirenment.

TOPICS
Error

Views

227

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2023 Dec 20, 2023

Copy link to clipboard

Copied

use document.getElemtnById()

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

Here's the code I cannot get to work.

 

This is in the javascript file Animate produces with Canvas. 

 

 

				function copyStringToClipboard (str) {
				 const el = document.createElement('textarea');
  el.value = str;
  document.body.appendChild(el);
  el.select();
  el.setSelectionRange(0,999999999999);
  document.execCommand('copy');
  document.body.removeChild(el);
				 }

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

use naviagator.clipboard.writeText()

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

Google Chrome javascript console says,

 

Uncaught (in promise) DOMException: Document is not focused.

 

Looks as if there is a security update in browsers to prevent dynamically writing to the clipboard.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

i don't see an error in chrome.  

 

is that function on the main timeline and called from the main timeline?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

This is on the main timeline.  This function used to work but a few months ago stopped working.  I am working on a workaround ( javascript alert or downloadable text file should work for my purposes ).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

i don't see that error. 

 

did you install a browser plugin after the problem started?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

It could be a dom_underlay_container I added to the HTML.  Also has an iframe associated with it.  I am just going ahead with my workaround.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2024 Jan 02, 2024

Copy link to clipboard

Copied

LATEST

ok

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines