188
rated 0 times
[
190]
[
2]
/ answers: 1 / hits: 20320
/ 11 Years ago, wed, march 27, 2013, 12:00:00
I have a website where user can select an item, the detail is then displayed, including the quantity. I have also included a button inside the div so that when clicked, it should decrease the quantity by 1.
$(#btnBuy1).click(function()
{
if (!sessionStorage['quantity1'])
{
sessionStorage['quantity1']=1;
}
else
{
sessionStorage['quantity1']++;
}
$(#dropbox).html('<div id = 1><img class = thumb id = t1 src=../images/birthday_metoyou.jpg />' + teddy[1].desc + , Price £
+ teddy[1].price + , Quantity: + sessionStorage.getItem('quantity1') + <button id = 'btnRemove1'>Remove</button></div><br/>);
updateBasket();
sessionStorage[total1] = parseInt(sessionStorage.getItem('quantity1')) * teddy[1].price;
updateSubtotal();
if (Modernizr.sessionstorage)
{ // check if the browser supports sessionStorage
myids.push(teddy[1].partnum); // add the current username to the myids array
sessionStorage[ids]=JSON.stringify(myids); // convert it to a string and put into sessionStorage
}
else
{
// use cookies instead of sessionStorage
}
});
$(#btnRemove1).click(function()
{
alert(remove);
});
I put in an alert message to see if the button is working properly, but when I click the btnRemove1 button, nothing happens.
More From » jquery