1

Im not a jQuerywiz, but I keep getting the "Uncaught TypeError: $(...). is not a function" on jQueryscripts. I'm trying to understand why I get them.

This is the code:

<script type="text/javascript" src="http://shop.xeptor.se/fileupload/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="http://shop.xeptor.se/fileupload/jquery.blackcalculator.src.js"></script>

<div class="calculator"></div>
<script type="text/javascript">
 $(document).ready(function(){
   var langs = {value: 'Valor', clear: 'Limpar', backspace: 'Voltar'};
   $('.calculator').blackCalculator({
     type:'advanced',
     allowKeyboard:true,
     css:'styles/',
     language:langs
   });
 });
</script>
Nishit Maheta
  • 6,021
  • 3
  • 17
  • 32
Xeptor
  • 467
  • 5
  • 18
  • Its a guess, Instead of $ try jQuery – Ramanathan Muthuraman May 20 '15 at 12:11
  • 1
    Have you checked that blackcalculator is properly loaded? jQuery appears to have loaded fine, because you didn't get a `$ is not defined` error. – Terry May 20 '15 at 12:11
  • The two links are valid, although jQuery 1.7.2 is more than 3 years old (march 2012). Maybe an outdated jQuery version? – Jeremy Thille May 20 '15 at 12:13
  • [this plunker](http://plnkr.co/edit/L16UWW18XbXTyddidEmU?p=preview) looks okay. Could it be something else? Am I missing something here? – scniro May 20 '15 at 12:14
  • Typical message when noConflict() is used – A. Wolff May 20 '15 at 12:15
  • My console is giving me a **Blocked loading mixed active content** .. [See this](https://stackoverflow.com/questions/18251128/why-am-i-suddenly-getting-a-blocked-loading-mixed-active-content-issue-in-fire).. – urbz May 20 '15 at 12:17
  • Would you show an exact error in console? or screenshot of console?, Would you share code of blackCalculator as well so that we can run the code – Parag Bhayani May 20 '15 at 12:19

1 Answers1

2

Close your jQuery code to:

(function($) {
 ...
})(jQuery);

This function will pass-in the jQuery object, so the browser will know, that the dollar sign is an abbreviation for jQuery. Otherwise the dollar sign is a very favourite one, so in your case it's probably represents something else :-)

The same problem was already solved here.

Community
  • 1
  • 1
Eenoku
  • 2,741
  • 4
  • 32
  • 64