prestashop_newuser Posted August 29, 2013 Share Posted August 29, 2013 Hi, In prestashop I am doing a small module. In that module my codes are something like this private function _displayForm() { $this->_html .= ' <link rel="stylesheet" href="../modules/newmodule/css/validationEngine.jquery.css" /> <script type="text/javascript"> jQuery(document).ready(function() { function loadinit() { alert(\'hiiiiii\'); [spam-filter]); </script> <script src="../modules/newmodule/js/jquery.min.js" type="text/javascript" charset="utf-8"> <script src="../modules/newmodule/js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"> <script src="../modules/newmodule/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"> '; $this->_html .= '<div> <script type="text/javascript">loadinit();</script></div>'; } Now you can see that I have made a function called loadinit() and I have called that function at very bottom. But when I load the page it throws me an error in firefox console tab ReferenceError: loadinit is not defined loadinit(); So can someone kindly tell me why this error is coming here and how to fix this? Any help and suggestions will be really appreciable. Thanks.. Link to comment Share on other sites More sharing options...
vekia Posted August 29, 2013 Share Posted August 29, 2013 your jQuery object is defined? why not $ ? Link to comment Share on other sites More sharing options...
prestashop_newuser Posted August 29, 2013 Author Share Posted August 29, 2013 (edited) your jQuery object is defined? why not $ ? I am doing a simply alert to check here and I have used jQuery instead of $. When I used $ instead of jQuery it showed me an error in console panel TypeError: $ is not a function $(document).ready(function() { . Can you tell me how to solve this issue. Edited August 29, 2013 by prestashop_newuser (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 29, 2013 Share Posted August 29, 2013 but have you got anywhere definition of the jQuery object? Link to comment Share on other sites More sharing options...
prestashop_newuser Posted August 29, 2013 Author Share Posted August 29, 2013 but have you got anywhere definition of the jQuery object? I am not getting what you want to tell. But can you tell me how to do this with some example codes or any helpful link where this has been explained? That will be more helpful to me and for others who have the same problem. Waiting for your reply . Link to comment Share on other sites More sharing options...
vekia Posted August 30, 2013 Share Posted August 30, 2013 it looks like jQuery object doesn;t exist. YOu have to define it. http://api.jquery.com/jQuery.noConflict/ + have you got any jquery library attached to the code? Link to comment Share on other sites More sharing options...
Recommended Posts