Fixes form reset
This commit is contained in:
1 parent
135fe821e1
commit
822fc058c8
1 file changed
+24
-23
+24
-23
@@ -1,26 +1,27 @@
|
||||
$(document).ready(function() {
|
||||
/* Customer selection */
|
||||
$("li.customer").click( function() {
|
||||
/* Enable all buttons */
|
||||
$("li.customer").each(function(i) {
|
||||
$(this).removeClass("selected");
|
||||
});
|
||||
/* Disable the customer button just clicked */
|
||||
$(this).addClass("selected");
|
||||
/* Update the form */
|
||||
$("input[name=customer]").val($(this).children("span.name").text());
|
||||
});
|
||||
/* Product amount controls */
|
||||
$("li.product").click( function() {
|
||||
var form_field = $(this).children("input[type=text]");
|
||||
var qty = Number(form_field.val()) + 1;
|
||||
form_field.val(qty);
|
||||
});
|
||||
/* Also reset the hidden customer fields */
|
||||
$("input[type=reset]").click( function() {
|
||||
$("input[name=customer]").val("");
|
||||
});
|
||||
|
||||
/* TODO: keyboard shortcuts */
|
||||
function enable_all_customers() {
|
||||
$("li.customer").each(function(i) {
|
||||
$(this).removeClass("selected");
|
||||
});
|
||||
}
|
||||
/* Customer selection */
|
||||
$("li.customer").click( function() {
|
||||
enable_all_customers();
|
||||
/* Disable the customer button just clicked */
|
||||
$(this).addClass("selected");
|
||||
/* Update the field */
|
||||
$("input[name=customer]").val($(this).children("span.name").text());
|
||||
});
|
||||
/* Product amount controls */
|
||||
$("li.product").click( function() {
|
||||
var form_field = $(this).children("input[type=text]");
|
||||
var qty = Number(form_field.val()) + 1;
|
||||
form_field.val(qty);
|
||||
});
|
||||
/* Form reset */
|
||||
$("input[type=reset]").click( function() {
|
||||
$("input[name=customer]").val("");
|
||||
enable_all_customers();
|
||||
});
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user