On my website (www.cooljools.biz), I have a list of products which are
displayed using PHP and a MySQL database (this tech detail is probably
irrelevent to the problem). Next to each item I have an 'Add' button
allowing customers to add the item to the shopping cart.
I need some way to toggle the text on the button between 'Add' and
'Added'. The problem being there is no way to know how many products
there will be, and therefore naming all the buttons uniquely would be
difficult.
I was wondering if there was a way of programatically finding out
which button fired the event and then do something along the lines of:
if (cause.value == "Added") {
cause.value == "Add";
}
else cause.value == "Added";
Any help on this would be appreciated.
Jacqueline
displayed using PHP and a MySQL database (this tech detail is probably
irrelevent to the problem). Next to each item I have an 'Add' button
allowing customers to add the item to the shopping cart.
I need some way to toggle the text on the button between 'Add' and
'Added'. The problem being there is no way to know how many products
there will be, and therefore naming all the buttons uniquely would be
difficult.
I was wondering if there was a way of programatically finding out
which button fired the event and then do something along the lines of:
if (cause.value == "Added") {
cause.value == "Add";
}
else cause.value == "Added";
Any help on this would be appreciated.
Jacqueline
Comment