我是jQuery的新手,整天都在试图确定这个脚本在jsFiddle中运行但不在我的计算机上的原因.我没有服务器设置,我只是从桌面启动浏览器中的html.
代码在这里工作正常:http://jsfiddle.net/9Dubr/164/.但是当我创建以下html文件时:
<html>
<head>
<title>this better work</title>
<script src="jquery-latest.js"></script>
<script type="text/javascript">
$('#submit').click(function(){
$('#myfrom').fadeOut("slow", function(){
var dot = $("<div id='foo'>Goodmorning Mr. Patti<br/><br/>Thank you.</div>".hide();
$(this).replaceWith(dot);
$('#foo').fadeIn("slow");
});
});
</script>
<style type="text/css">
#container{
width:342px;
height:170px;
padding:10px;
background-color:grey;
}
#myform{
width:322px;
height:100px;
color:#6F6F6F;
padding: 0px;
outline:none;
background-color:white;
}
#foo{
width:322px;
height:100px;
color:#6F6F6F;
padding: 0px;
outline:none;
background-color:white;
}
#submit{
color:#6F6F6F;
padding: 10px 2px 0px 0px;
margin: 0px 0px 0px 0px;
outline:none;
}
</style>
</head>
<body>
<div id="container">
<div id="myform">
<p> blah …Run Code Online (Sandbox Code Playgroud)