Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Ashish Mehra
Courses Plus Student 103 Pointsonclick event "action is not a function"
whenever i make a click on image the console show me "uncaught reference error "
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title></title>
</head>
<body>
<div id="wrap">
<ul id="menu">
<li><a href="#" data-icon="">Home</a></li>
<li><a href="#"data-icon="">Contact</a></li>
<li><a href=""data-icon="">Portfolio</a></li>
<li><a href="#"data-icon="">About</a></li>
</ul>
<img src="click.png" id="show" onclick ="action()">
</div>
<script src="animate.js"></script>
</body>
</html>
function action(){
alert("working");
}
1 Answer
Chyno Deluxe
16,936 PointsIt seems that your javascript file is not linked on your html. Only the animate.js file is.
Ashish Mehra
Courses Plus Student 103 PointsAshish Mehra
Courses Plus Student 103 Pointsanimate.js is the same file which i link with html but it directly not calling function from index.html but when i making an click event under .js file it work properly