1

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 {

Boaz
  • 19,892
  • 8
  • 62
  • 70
user2915962
  • 2,691
  • 8
  • 33
  • 60

2 Answers2

3

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

Community
  • 1
  • 1
Maen
  • 10,603
  • 3
  • 45
  • 71
2

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

Please try below

$(function(){ 
  $(".product-add-link").on("click", BindAddProduct); 
 });
Murali Murugesan
  • 22,423
  • 17
  • 73
  • 120