Taken together, the code for the shopping cart page is a mere 79 lines—quite small considering the functionality it accomplishes, but especially so when we take into account the breezy style that the code has acquired for optimum readability. Because of jQuery’s chainability, many of the lines could have been merged were we particularly concerned with number of lines. At any rate, here is the finished code for the shopping cart page, which concludes this chapter on forms:
$(document).ready(function() { // shopping cart var stripe = function() { $('#cart tbody tr:visible:even').removeClass('odd') .addClass('even'); $('#cart tbody tr:visible:odd').removeClass('even') .addClass('odd'); }; stripe(); $('#recalculate').hide(); $('.quantity input').keypress(function(event) { if (event.charCode && (event.charCode < 48 || ...