Yang Mega
Posts: 0
Joined: Sun Aug 31, 2014 6:08 am

How quantity label need to change after click +plus or -minus button in dynamic item list

Pls see the attached screenshot , I up one is using now, but I suppose to change to below one that can change the quantity by click the + or - button,

  1. The item list is download from database while page show

  2. In general, I can use " click the + button, then Run JavaScript = Appery('labelname').text(qty)....

  3. But the problem in dynamic itemlist, I don't know the name after download from DB to map to itemlist

    This is the application for restraurant Menu , If anyone can help me ??? Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How quantity label need to change after click +plus or -minus button in dynamic item list

Hello,

You can get the desired element using JQuery methods. For example
prev() http://api.jquery.com/prev/
or next() http://api.jquery.com/next/
The specific implementation depends on the structure of elements in your application.

Yang Mega
Posts: 0
Joined: Sun Aug 31, 2014 6:08 am

How quantity label need to change after click +plus or -minus button in dynamic item list

Thanks Evgene, You always show me right direction

Yang Mega
Posts: 0
Joined: Sun Aug 31, 2014 6:08 am

How quantity label need to change after click +plus or -minus button in dynamic item list

That is not what function I need,
.prev( [selector ] )
Get the immediately preceding sibling of each element in the set of matched elements

I just need to change the number label by click two button + and -

Yang Mega
Posts: 0
Joined: Sun Aug 31, 2014 6:08 am

How quantity label need to change after click +plus or -minus button in dynamic item list

I add JS after plusButton click:
=================
$(this).next().val(35);
$(this).next().text(35);
$(this).next().css("background", "#f99" );
console.log($(this).next().val());
===================
define page as below
Image
==================
While testing, console show "undefine" and nothing happen ??? why?
Image
Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How quantity label need to change after click +plus or -minus button in dynamic item list

Hello,

Your question is answered via email, please find our reply there.

Enfiled Riders
Posts: 0
Joined: Fri Jun 05, 2015 6:07 am

How quantity label need to change after click +plus or -minus button in dynamic item list

What is the reply?
Can you please explain it here?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How quantity label need to change after click +plus or -minus button in dynamic item list

Hello!

The reply was:
Most likely, your code is not quite correct. It all depends on what is the structure of the nodes on your page. Your button and the label may not to be the siblings. Maybe you should climb to a higher level or vice versa fall. Maybe this link will be useful http://stackoverflow.com/questions/14...

Return to “Issues”