Implementation of TogetherJS is not working

986 views Asked by At

I am trying to make a simple shareable text editor with Mozilla's TogetherJS, but it does not seem to work. Based on their instructions, I added the library/script in the head and calling the JS from the button.

https://togetherjs.com/

In the Head tag:

<script src="https://togetherjs.com/togetherjs-min.js"></script>

In the body:

<button onclick="TogetherJS(this); return false;">Start TogetherJS</button>

Full code:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Test JS</title>
</head>
<body>
  <button onclick="TogetherJS(this); return false;">Start TogetherJS</button>

  <div>
    <textarea style="border:1px solid red; height:300px; width: 500px; font-size: 16px;">
   </textarea>
</div>

  <script src="https://togetherjs.com/togetherjs-min.js"></script>
  </body>
</html>

It seems to super-simple, yet for some reason, it does not seem to work!

1

There are 1 answers

2
Himanshu Pandey On

Could you please check now wrap your script in the body i.e.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Test JS</title>
</head>
<body>
  <button onclick="TogetherJS(this); return false;">Start TogetherJS</button>

  <script src="https://togetherjs.com/togetherjs-min.js"></script>
</body>
</html>