Appcan Multiple list shopping cart add and Subtract quantity example

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.