Build a Calculator -- Error message



Getting this error :Did you define the '.click()' correctly? Look at the hint if you need help

    var testNumLength = function(number) {
        if (number.length > 9) {
            if (number.length > 15) {
                number = "";
    var number = "";
    var newnumber = "";
    var operator = "";
    var totaldiv = $("#total");

    //Add your .click() here!
    $('#numbers a').not('#clear,#clearall').click(function(){
       number += $(this).text();


The only thing i see is that they ask you to use

number += $(this).html();

in your =click= Eventhandler.

I am having the same error,
even when using as selector

$("#numbers > a")


Hi guys !
I pass it with that:

number += $(this).html(numbers);

Not sure if it's the good answer but it works.

Have a good day .


Thank you so much! This was a big help to me.


You're welcome !
Glad that help you. :slight_smile:


It seems to be some problem though it passes the test.


Hi, can you explain to me why we have to write:

number +=$(this).html(numbers);

and what does += mean?


Hi !
Sorry I don’t remember why this works.

But “number += 2” is the same thing that “number = number + 2”.

With += you can add directly a number (or a string) to your variable.

Maybe that will help you a little ! :slight_smile:


Does that mean I can write number = number + $(this).html(numbers); ?

Btw, thank you for answering my question. That helps me a lot :slightly_smiling_face:


Yes, you can write "number = number + $(this).html(numbers);"
It’s the same thing, just one is shorter than the other.


Thank you…:slightly_smiling_face: