Closed (fixed)
Project:
jQuery 4.7
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2006 at 12:48 UTC
Updated:
28 Dec 2006 at 15:02 UTC
This is what Iam trying to do.
I have added the jquery47 module. Enabled it.
Created a test java script file called testjavascript.js with the following contents
$JQ(document).ready(function(){
$JQ("p.jtest").fadeIn(6000);
});
Then I created a story in drupal with the following content
<?php
jquery47_add_js('themes/multiflex/javascripts/testjquery.js');
?>
<p class="jtest" style="background-color: palegreen; width: 30em;">
This is an example of an effect which is built into the core jQuery
library. This text should fade in after the DOM is loaded. <a
href="http://api.drupal.org/api/HEAD/function/drupal_add_js">
drupal_add_js()</a> was used to add the <a href="http://jquery.com/api/"> fadeIn</a> effect to any paragraph with the class <b>jtest</b>.
</p>
The effect is not working. I tried to debug it myself, but Iam no JS expert. I tried to evaluate using the firefox browser., but it says this
Error: $JQ is not defined
Source File: http://www.cbitworld.com/themes/multiflex/javascripts/testjquery.js
Line: 1
It will be gr8 to know where Iam messing
Thanks
Comments
Comment #1
mfredrickson commentedNo problem. Glad to help.
The trick here is that you are invoking
$JQ("some expression")when you really wantJQ("some expression"). You don't need the $.You may also want to use the drupal native method of running functions when the document loads. I remember having problems trying to use jQuery's method. Here's an example from some code I wrote a while ago:
Good luck. Feel free to reopen this if you need more help.
Comment #2
arava_phani commentedAppreciate it. It works