I wrote some JQuery code in an .js.coffee file and I get the following error: TypeError: ‘word’ is undefined.
I am new with Rails 3.1 so I am not sure what this error message means.
Here is a snippet of the code int the .js.coffee file:
$(document).ready(function(){
$("#project_name").focus(function(){
changeBorder("project_name");
});
$("#project_name").blur(function(){
resetBorder("project_name");
});
...
});
function changeBorder(formName){
$("#" + formName).css({border: '1px solid #168DD8', background: '#f2f2f2'});
}
function resetBorder(formName){
$("#" + formName).css({border: '1px solid #999999', background: '#ffffff'});
}
Appreciate any help.
why are you writing javascript in your .js.coffee file? If you want to use Javascript, rename file extension to .js