0

a1 is not a function?

i made this code for the knight challenge <!DOCTYPEhtml> <html> <head> <script src="https://code.jquery.com/jquery-3.1.1.js"></script> </head> <body> <table id="schaakbord"> <tr> <td onclick="h1()" id="h1"></td> </tr> </table> <script> function h1(){ $("#h1").css("background-color","#ab1234"); } </script> </body> </html> but when i click on h1 it errors h1 is not a function

27th Apr 2018, 3:28 PM
Roel
Roel - avatar
5 ответов
+ 2
Nothing wrong with the posted code; maybe you have something wrong with your actual code.
27th Apr 2018, 3:51 PM
Nommer101
Nommer101 - avatar
+ 2
It works for me...
27th Apr 2018, 3:53 PM
Nommer101
Nommer101 - avatar
0
i just litterally copy-pasted it☺
27th Apr 2018, 3:52 PM
Roel
Roel - avatar
0
wait ill send you the complete code
27th Apr 2018, 3:53 PM
Roel
Roel - avatar
0
saw the mistake.... function start(){ //lot of actions if(){ //if action } else{ //action } function h1(){ //action } see the mistake too? i missed a curly bracket to close the start function
27th Apr 2018, 3:58 PM
Roel
Roel - avatar