<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var wifi;
var firewall;
var backup;
var vpn;
var install;
$('submit').click(function(){
wifi = $('input[name=wifiPrice]').val();
firewall = $('input[name=firewallPrice]').val();
backup = $('input[name=backupPrice]').val();
vpn = $('input[name=vpnPrice]').val();
install = $('input[name=installPrice]').val();
$('list').append('<p>' + wifi + '</p>');
});
});
</script>
</head>
<body>
<div id="cccontainer">
<form id="costComparer" name="pricesForm">
<table>
<tr>
<td class="label" id="wifi">Wifi:</td><td><input type="text" name="wifiPrice"></td>
</tr>
<tr>
<td class="label" id="firewall">Firewall:</td><td><input type="text" name="fireWallPrice"></td>
</tr>
<tr>
<td class="label" id="backup">Backup:</td><td><input type="text" name="pBackupPrice"></td>
</tr>
<tr>
<td class="label" id="vpn">VPN:</td><td><input type="text" name="vpnPrice"></td>
</tr>
<tr>
<td class="label" id="install">Installation:</td><td><input type="text" name="installPrice"></td>
</tr>
<tr>
<td></td><td><input type="button" value="Submit" /></td>
</tr>
</table>
</form>
<div id="list"></div>
</div>
</body>
</html>
我正在尝试获取wifiPrice
输入字段的值,并将其附加到
容器放入<div id="list">
. 但是,它似乎没有做任何事情。有人能指出我哪里出错了吗?谢谢你。