jquery: length is null or not an object

jquery: length is null or not an object

The function below results in this error and I'm not sure how to correct it? The initial value of the field is 0.00, but it doesn't look like it's relevant... That is, even when the value isn't 0, it still results in this error.

if($("input[name='b2h']")) {
                        $("input[name='b1']").bind("keyup", b2);
                        b2();
                }
   function b2() {
                $("[id=b2]").calc(
                        "b2h + b1",
         {
                            b1: $("input[name=b1]"),
            b2h: $("input[name=b2h]")
                   },
                        function (s){
                                return "$" + s.toFixed(2);
                        },
                        function ($this){
                                var sum = $(this).sum();
                                $("#b2").text(
               "$" + sum.toFixed(2)
                                );
                        }
                );
   }