javascript - increase number automatically in the text field after clicking save button -
i had text field named bill no
,my problem increase value in text field automatically , bill no
1 , after clicking save button should save 1 after saving bill no
should automatically increase 2 ,
any advice ?
<%@ 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>
try code below, if save bill no through ajax, increase number in ajax success callback.
$("#your-save-button-id").click(function(){ ... save action here ... $("#bill_no").val(parseint($('#bill_no').val()) + 1); })
Comments
Post a Comment