Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery error: missing ( before formal parameters

I have this jQuery script:

<script type="text/javascript">

  $(document).ready(function{
    $("#btnLogon").bind("click", function(){
      $("#btnLogon").after('<span class="error">Please wait...</span>');
    });
  });

</script>

In Firebug I get the error message

missing ( before formal parameters

What am I doing wrong here?

like image 463
arame3333 Avatar asked Nov 30 '22 17:11

arame3333


2 Answers

$(document).ready(function{

should be

$(document).ready(function(){
like image 76
ThiefMaster Avatar answered Dec 04 '22 03:12

ThiefMaster


<script language="javascript" type="text/javascript">
$(document).ready(function(){
    $("#btnLogon").bind("click", function(){
        $("#btnLogon").after('<span class="error">Please wait...</span>');
    });
});
</script>

You were missing the parentheses after function, on the second line.

like image 42
Håvard Avatar answered Dec 04 '22 02:12

Håvard