Hi,
I am trying to display a list of events, that are thrown from JSON, and displayed using JS dynamically using .APPEND
I am also adding a textbox QTY for each event and ADD TO CART link, so people can enter the number of tickets they reserve for the event and add it to the cart.
How do I send the parameters to the JS function about what's entered in the qty textbox, this is what I have:
function initEvents(){
for (i = 0; i < allevents.length; i++) {
$('div#eventcontainer').append('<div id="rightcolumn"><h2>' + allevents[i].eventname + '</h2><br /><br />' + allevents[i].starttime + '<br /><br />' + allevents[i].endtime + '<br />qty: <input id="qty" type="text"><br /><a href="#" onclick="addToCart(\'' + allevents[i].id + '\',\'qty\')">add to cart</a></div>')
}
}
addToCart function works great without 'qty', but when I add qty parameter it's not....![]()


Reply With Quote

Bookmarks