Page 1 of 1

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

Posted: Tue Nov 04, 2014 9:22 am
by Yang Mega

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


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

Posted: Tue Nov 04, 2014 10:46 am
by Evgene Karachevtsev

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.


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

Posted: Tue Nov 04, 2014 3:57 pm
by Yang Mega

Thanks Evgene, You always show me right direction


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

Posted: Wed Nov 05, 2014 1:41 am
by Yang Mega

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 -


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

Posted: Wed Nov 05, 2014 5:03 am
by Yang Mega

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


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

Posted: Wed Nov 05, 2014 10:59 am
by Evgene Karachevtsev

Hello,

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


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

Posted: Thu Jul 16, 2015 4:01 am
by Enfiled Riders

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


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

Posted: Thu Jul 16, 2015 5:55 am
by Evgene Karachevtsev

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...