user2915962
user2915962

Reputation: 2711

missing ; before statement?

I am getting an error on this, what have I missed?

My Code:

$function(){ 
            $(".product-add-link").on("click", BindAddProduct); 
        }

Firefox says:

missing ; before statement

Chrome says:

unexpected token {

Upvotes: 1

Views: 175

Answers (2)

Maen
Maen

Reputation: 10698

You forgot parenthesis :

$(function(){ 
    $(".product-add-link").on("click", BindAddProduct); 
});

The shortcut $(function(){}) is an equivalent of document.ready(function(){});.

Please refer to this post for further informations

Upvotes: 3

Murali Murugesan
Murali Murugesan

Reputation: 22619

jQuery $ accepts a function as parameter. You missed ( for passing your function.

Please try below

$(function(){ 
  $(".product-add-link").on("click", BindAddProduct); 
 });

Upvotes: 2

Related Questions