Missing ( before formal parameters

Hello, I am getting an error with this code and I can not diagnose it:

The error is:

missing ( before formal parameters

function reserve-drop-down() {
          var sel = document.getElementById("reserve-drop-down");
          sel.onfocus = function () {this.style.width = "auto";};
          sel.onblur = function () {this.style.width = "125px";};

Any ideas anyone please?

Thanks for reading :slight_smile:

The hyphen in the function name.
The function name may contain only alphanumeric characters and the underscore.

Oh, really… never knew that! Thanks :slight_smile:

$ is also a valid character. There are 54 characters that are valid in JavaScript variable/function/object/propery/method names -


It is even worse-
the first character of an identifier cannot be a digit, though any number of digits can be used thereafter.