1

I was using the Richfaces4, everything looks good. But just right after I add following line to my pom.xml:

<dependency>  
    <groupId>org.primefaces</groupId>  
    <artifactId>primefaces</artifactId>  
    <version>3.5</version>  
</dependency> 

The following error shows up when I tried to login, Seems the "Richfaces" and "jQuery" not been include/import to my server?

 $ is not a function
    [Break On This Error]   

    </div><script type="text/javascript">$(document).ready(function() {

    home.seam (line 93)
    RichFaces is not defined
    [Break On This Error]   

    ...="display: none;"><script type="text/javascript">checkUpTime=function() 
    {RichFace...
David Lee
  • 108
  • 7

2 Answers2

0

use jQuery.noConflict() because you are have jQuery which conflicting with other library.

Description: Relinquish jQuery's control of the $ variable.

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery's case, $ is just an alias for jQuery, so all functionality is available without using $. If you need to use another JavaScript library alongside jQuery, return control of $ back to the other library with a call to $.noConflict(). Old references of $ are saved during jQuery initialization; noConflict() simply restores them.

Read More

Example

jQuery.noConflict();
   
// Use jQuery via jQuery(...)
jQuery(document).ready(function()
{
    jQuery("div").hide();
});

OR

var $jQ = jQuery.noConflict();

// Use jQuery via $jQ(...)
$jQ(document).ready(function()

{
    $jQ("div").hide();
});

Use the following technique, which allows us to use $ inside of a block of code without overwriting $:

(function($) { /* some code that uses $ */ })(jQuery) 
Community
  • 1
  • 1
Dipesh Parmar
  • 27,090
  • 8
  • 61
  • 90
0

It is now solved in Primefaces 3.5.1. This was marked as issue 5219. To see the change in PrimeFaces source, check revision 8796.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Jitesh
  • 1,384
  • 10
  • 20