Need jQuery onClick To Change Button Text and Background-Color

I am on Wordpress 4.9.8 and WooCommerce 3.5.4.

I am trying to get a button using jquery to change background color and change the text in the button onClick.  I have come up with this code but when I try to save it I get an error.  

JavaScript error: ReferenceError: jQuery is not defined on line 6

Open in new window

this is line 6

Open in new window

<script type="text/javascript">

jQuery(function() {
	jQuery('#cook').click(function(e) {
		document.cookie = "wantmembership=1; path=/";
              jQuery(this).text("I Have Membership");


Open in new window

I am very new to jQuery.

Please tell me how to fix this code to change the background-color and the text both.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris StanyonWebDevCommented:
The 'jQuery is not defined' error usually means that you haven't loaded the jQuery library. Check the source of your page to make sure you're referencing a value jQuery libray.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sharingsunshineAuthor Commented:
That did it!  Thanks for the help.

I added this line and they both worked using this code

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.