我有一个名为bill no
的文本字段,我的问题是自动增加文本字段中的值,就像最初bill no
将为1一样,点击保存按钮后它应保存为1保存bill no
应自动增加到2,
任何建议?
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sales</title>
<link href="css/module.css" rel="stylesheet" type="text/css">
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<script src="js/date.js"></script>
<script>
$(document).ready(function() {
$(".datepicker").datepicker({dateFormat:"yy-mm-dd"});
});
</script>
</head>
<body>
<div class="reg-form">
<form method="post" name="sales" action="sales">
<table class="main">
<thead>
<tr>
<th>SALES
</th>
</tr>
</thead>
</table>
<table class="in-sec-small">
<tbody>
<tr>
<td class="label">
<label for="patient-type">PATIENT TYPE
</label>
</td>
<td>
<select id="patient_type" class="textfield-form-req-select" type="text" name="patient_type" required>
<option value="member">IP</option>
<option value="non-member">OP</option>
<option value="non-member">WIP</option>
</select>
</td>
<td class="label">
<label for="reg-type">REG TYPE
</label>
</td>
<td>
<select id="reg_type" class="textfield-form-req-select" type="text" name="reg_type" required>
<option value="member">Member</option>
<option value="non-member">Non Member</option>
</select>
</td>
<td class="label">
<label for="bill-no">BILL NO
</label>
</td>
<td>
<input id="bill_no" class="textfield-form-date-req" type="text" name="bill_no" required>
</td>
</tr>
答案 0 :(得分:0)
尝试以下代码,如果您通过ajax保存帐单,请增加ajax成功回拨中的数字。
$("#your-save-button-id").click(function(){
... do your save action here ...
$("#bill_no").val(parseInt($('#bill_no').val()) + 1);
})