SoFunction
Updated on 2025-04-13

jQuery method to quickly add or subtract product quantity

I won’t say much nonsense, I will just post the code to you. The specific code is as follows:

<!-- Quickly implement quantity addition and subtraction -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/jquery/1.10.2/"></script>
<script>
$(document).ready(function(){
//Get text box objectvar t = $("#text_box");
//The initialization number is 1 and the failure is reduced$('#min').attr('disabled',true);
 //Add number operation $("#add").click(function(){ 
  // Add an absolute value to the obtained val to avoid negative numbers  ((parseInt(()))+1);
  if (parseInt(())!=1){
  $('#min').attr('disabled',false);
  };
 }) 
 //Number reduction operation $("#min").click(function(){
 ((parseInt(()))-1);
 if (parseInt(())==1){
 $('#min').attr('disabled',true);
 };
 })
});
</script> 
</head> 
<body> 
<input  name="" type="button" value="-" /> 
<input  name="" type="text" value="1" style="width:30px;text-align: center"/> 
<input  name="" type="button" value="+" /> 
</body> 
</html>

It is that simple to implement quantity addition and subtraction!

The above is the method of quickly adding and subtracting jQuery products introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!