javascriptjquerygraphael

$each error after copying code


I have developed a chart using graphael(my question has nothing to do with this), and I am calling an $each function.

When I had my chart at a different project, the function was working fine and the chart was showing correctly. When I copied exactly the same code at a different project, I get the following error

Uncaught TypeError: Cannot call method 'each' of undefined 

Do you know what can be wrong?


Solution

  • Since you are attempting to execute each as a property of $ and are getting the following error,

    Uncaught TypeError: Cannot call method 'each' of undefined 
    

    we can assume that $ is undefined. This is often caused by not including the jquery library in your project.