javascriptjquerytrumbowyg

Can´t get Trumbowyg to work. Reference error caught


I'm trying to get Trumbowyg (https://alex-d.github.io/Trumbowyg/) to work and here is the code I'm trying to run:

<html>
<head>

  <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="//cdn.rawgit.com/Alex-D/Trumbowyg/v2.5.1/dist/ui/trumbowyg.min.css">
  <link rel="stylesheet" href="//cdn.rawgit.com/Alex-D/Trumbowyg/v2.5.1/dist/plugins/colors/ui/trumbowyg.colors.min.css">
  <script src="//cdn.rawgit.com/Alex-D/Trumbowyg/v2.5.1/dist/trumbowyg.min.js"></script>

</head>
<body>

<textarea id="hello" name="hello"></textarea>

<script>
  $(document).ready(function(){
   $('#hello').trumbowyg();
  });
</script>   


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

</body>
</html>

And it's no working. I'm really now good at Jquery :(

The error google console is throwing is:

Uncaught ReferenceError: $ is not defined at skit3.php:14

All help is appreciated.

Thank you.


Solution

  • You need to put :-

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    

    Above this:-

    <script src="//cdn.rawgit.com/Alex-D/Trumbowyg/v2.5.1/dist/trumbowyg.min.js"></script>
    

    Change this and it will work.

    Note:- Whenever you are going to work with any third-party js library or your own script code, jquery library need to be added before it.