Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example of using jQuery (even works with SSR! 🎉) #48

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Oct 1, 2021

Overview

Per ProjectEvergreen/greenwood#523 and this recent tweet reminding us all / highlighting the impactful legacy of jQuery (and out of curiosity), wanted to make sure it worked out of the box with Greenwood, which it does. But pleasantly, found out SSR works with too, so, that's cool. 😎

jquery-greenwood-getting-started-build
jquery-greenwood-getting-started-ssr

The intent isn't to merge this PR, but rather provide an example and demonstration for how to add it to a Greenwood project for others to follow.

Steps

For the most part, I only had to follow the installation steps in the jQuery docs.

$ npm install jquery

Usage

Take any page or template, and add some jQuery! ✨

<html>

  <head>
    <script src="/node_modules/jquery/dist/jquery.js"></script>
    <script>
      $(document).ready(() => {
        $('button.continue')
          .html('Next Step...')
          .on('click', (event) => {
            alert('On to the Next Step!');
          });
      });
    </script>
  </head>

  <body>
    <button class="continue"></button>
  </body>

</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant