jQuery – How to test a jQuery script
-
Subject: jQuery – How to test a jQuery script
Wordpress Version: 3.3.1
Theme: A simple Love (child theme for “Thematic”I’m trying desperately to use jQuery. I’ve read and tried tons of jQuery coding but can’t get it to work.
I’m trying to test whether or not my jQuery library is working – right now it isn’t. I’ve created a new page in my theme I’ve entered a very simple test that shows a paragraph and when that paragraph is clicked on, an “alert” box shouldl open and display “Works.” So here’s the code:I’m using an “onclick” function that will show an “alert” box when one clicks on the paragraph. So, first I add the paragraph and include the ‘onclick’ event:
<p onclick=“alert (‘Works’);”>This is a paragraph</p>Last, I add the jQuery code (within the new page):
<script type=”text/javascript” src=”https://giftsrus.org/wp-includes/js/jquery/jquery.js”></script>What is supposed to happen is a paragraph will be displayed (no problem there) and when clicked on the alert box displays “Works.” However, nothing happens when I click on the paragraph. I have several jQuery scripts to add but can’t even get the most simplest of code to work. I think the issue might be in my ‘src’ code for jQuery within my sight but I’m not sure. I’m not exactly sure where the jQuery library is and how to reference it.
Any help would be greatly appreciated.
Thx.
Cleop87
- The topic ‘jQuery – How to test a jQuery script’ is closed to new replies.