jquery-toast-plugin icon indicating copy to clipboard operation
jquery-toast-plugin copied to clipboard

Installation instructions

Open eduardoltorres opened this issue 5 years ago • 4 comments

I think the installation instructions could be a bit more detailed or at least reference to external resources. For those of us starting out it isn't so clear how to set it up. I've been trying to install it for an hour now with no success. Perhaps a response to this post might suffice as well.

Thanks in advance.

eduardoltorres avatar Dec 28 '18 06:12 eduardoltorres

The front page of this project has installation instructions, and they're effectively the same as for every other 3rd-party jquery plugin: "directly download the repository and place the content of dist wherever you can access them." i.e. download this repo, copy the contents of its "dist" folder to somewhere in your HTML tree, and include the js and css files in your HTML exactly as is done for any js/css files.

sgbeal avatar Dec 28 '18 07:12 sgbeal

I've followed the exact steps therefore I have:

  • added jQuery as pre-requisite
  • installed the plugin via npm
  • included the CSS and JS with their CDN ("You can simply download the repo or if you are in rush the minified CSS or non-minified CSS can be found and minified JS and non minified JS can also be found.")
  • did $.toast('Toast message to be shown'), as the instructions say

However, I still get an error in the console:

Uncaught TypeError: $.toast is not a function
    at index.js:10

I've also tried to add it as a function for a click event attached to one of my HTML elements, obviously with no success.

I am aware that the step that might be missing is potentially a basic or fundamental one that has nothing to do with 3rd party plugins. I do think that at least referencing to more general instructions--which I'm guessing is what I'm missing--would ideally complement 3rd party plugins' instructions.

Thanks for your response.

eduardoltorres avatar Dec 28 '18 07:12 eduardoltorres

The best place to start is to look at the source code for the demo site linked to on the project home page. That demonstrates everything you need to include, and in which order (it sounds to me like you are including jquery after the plugin). Simply open the demo site and use your browser's "view source" option, then go through that line by line.

sgbeal avatar Dec 28 '18 07:12 sgbeal

Solved!

The links for the CDNs don't work. I won't submit a PR because the README specifies to "report" bugs or features. In any case, the CDNs can be found here: https://www.cdnpkg.com/jquery-toast-plugin

Thanks @sgbeal for your help and quick responses.

eduardoltorres avatar Dec 28 '18 12:12 eduardoltorres