谁能明白为什么我的 javascript/jquery 不工作?谢谢!!!
HTML (就业.php)
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="resume_script.js"></script>
</head>
<title>Employment</title>
<body onload="load">
<h1>Employment History</h1>
<button type="button" id="add_job">+</button>
<form action="result.php">
Start Date: <input type="text" id="start_date"> End Date: <input type="text" id="end_date"> <br><br>
Description:<br> <textarea id="position"></textarea> <br>
<div id="add_form"></div>
<input type="submit">
</form>
<div id="footer">
<ul>
<li><a href="contact.php">Contact</a></li>
<li><a href="position.php">Position</a></li>
<li><a href="employment.php">Employment</a></li>
<li><a href="resume.php">Resume</a></li>
</ul>
</div>
</body>
</html>
JAVASCRIPT (resume_script.js)
$(function(){
alert("test");
$('#add_job').click(addJob);
});
function load(){
alert("Page is loaded");
}
function addJob(){
alert('test');
$('Start Date: <input type="text" name="start_date"> End Date: <input type="text" name="end_date"> <br><br>').appendTo('#add_job')
}
我没有收到任何警报
我想通了,这只是一个小的语法错误。感谢大家的帮助并推荐我使用控制台!