The HTML code is as follows:
<div class= "Uinn4 White" id= "ListView" >
<ul>
<!--------list looping---->
<li class= "Ubb ub bc-border t-bla ub-ac lis" data-index= "0" >
<div class= "checkbox Umar-r" >
<input type= "checkbox" class= "Uabs Ub-con"/>
</div>
<ul class= "UB UB Ub-ver" >
<li class= "" >
<div class= "Lis-icon ub-img" style= "Background-image:url (images/shopping_list.png)" ></div>
<div class= "Ulev-1 bc-text umar-t" ></div></li>
</ul>
<ul class= "Ub-f1 ub UB-PJ Ub-ac" >
<ul class= "Ub-f1 ub ub-ver marg-l" >
<li class= "Bc-text UB ub-ver ut-m line1" ><span class= "Pro_name" > Lenovo notebook </span><br/> Spec.: <span class= "code" >y430p</span><br/> Integration value: <span class= "Red Jifen" >28800</span></li>
<li class= "Ulev-1 sc-text1 uinn3" >
<div class= "UB Ub-ac" >
<div class= "ub-f1 t-gra3 ulev-3" >
Number
</div>
<div class= "UB ub-f3" >
<div class= "Minus uwh-psc1 tx-c uba bc-border uc-a-app1 t-bla mar-ar1" >
-
</div>
<div class= "Uba uc-a-app1 bc-border uinput uwh-psc1 mar-ar1 c-wh" >
<input value= "1" type= "text" class= "uinn-psc3 t-bla tx-c"/>
</div>
<div class= "plus uwh-psc1 tx-c uba bc-border uc-a-app1 T-bla" >
+
</div>
</div>
</div> </li>
</ul>
</ul></li>
<!-------list Loop End----->
</ul>
</div>
For such multiple values to change multiple input, the value of this can be used to obtain the corresponding input.
Add:
$ (". Plus"). Click (function () {
var t=$ (this). The parent (). Find (' input.tx-c ');
T.val (parseint (T.val ()) +1);
Settotal ();
})
Reducing:
$ (". minus"). Click (function () {
var t=$ (this). The parent (). Find (' input.tx-c ');
T.val (parseint (T.val ())-1)
if (parseint (T.val ()) <0) {
T.val (0);
Alert ("The number is already 0");
}
Settotal ();
})
Calculate Total Amount:
/*function Settotal () {
var s=0;
$ ("#listview Li.lis"). each (function () {
S+=parseint ("This"). Find (' Input.tx-c '). Val ()) *parsefloat ($ (this). Find (' Span.jifen] '). text ());
});
$ ("#total"). HTML (s.tofixed (2));
}
Settotal ();
Appcan Multiple list shopping cart add and Subtract quantity example