127
rated 0 times
[
134]
[
7]
/ answers: 1 / hits: 62477
/ 11 Years ago, sat, july 6, 2013, 12:00:00
so I feel(and hope) this is pretty simple. I am new to javascript and am trying to get this working. When I link to my external .js file from my html it does not function. However, when entering the script code directly into my HTML it DOES work.
Here is the js file:
$(document).ready(function(){
$(#flip).click(function(){
$(#panel).slideToggle(slow);
});
});
This is the index.html file:
<!DOCTYPE html>
<html>
<head>
<title>slidepanel test</title>
<script type=text/javascript src=script.js></script>
<link rel=stylesheet type=text/css href=style.css/>
</head>
<body>
<div id=flip>Click to slide the panel down or up</div>
<div id=panel>Hello world!</div>
</body>
</html>
and this is the CSS:
#panel,#flip
{
padding:5px;
text-align:center;
background-color:#e5eecc;
border:solid 1px #c3c3c3;
}
#panel
{
padding:50px;
display:none;
}
More From » jquery