Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

 2 Answer(s)

  • ReferenceError: $ is not defined
    $("#calculate").click(function() {
    
    });
    .
    .
    to solve this problem showing $ is not defined, all you need to do is to import jquery cdn to your index.php file because that piece is a jquery code ...
    you import it by going to jquery site online and copy the minifies cdn script and paste it in your index.php head.
    
    
  • I would like to address some issues in your code.
    The very first thing is your code seems to be using jQuery, but the jQuery library is not included on the page.
    Additionally, If you check your console, you will find an error message :

    ReferenceError: $ is not defined
    $("#calculate").click(function() {
    

    You are trying to create a custom id based selector,

    var $ = function (id) {
        return document.getElementById(id);
        }
    

    In this process you assign your function to variable "$", which is itself an object of jQuery. This assignment destroys the jquery object, Hence the above error.

    For solution, check this fiddle

    I suggest you to read about javascript scope and callbacks.

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: