Hi :)

I was interested to see the new data method (is it a 'method'?) and
imagine I should be using it with the shopping basket I'm building.
But I can't work out how to use it properly!

I presently have code like this:
                        $( 'form.basket .productchoice:last[value]' ).val( 
productid ) ;
                        $( 'form.basket .myproduct:last > span' ).html( product 
) ;
                        $( 'form.basket .description:last[value]' ).val( number 
) ;
                        $( 'form.basket .price:last[value]' ).val( 
unitprice.toFixed(2) ) ;
                        number = parseInt( number ) ;
                        unitprice = parseFloat( unitprice ) ;

                        var currNum = $( '#totalnumber' ).val() ;
                        var currPrice = $( '#totalprice' ).val() ;
                        currNum = parseInt( currNum ) ;
                        currPrice = parseFloat( currPrice ) ;

                        $( '#totalnumber' ).val( number + currNum ) ;
                        $( '#totalprice' ).val( (unitprice + 
currPrice).toFixed(2) ) ;

 - it's at http://vanilla-spa.co.uk/shop.php

I haven't even finished it and I've already got vars all over the
place, plus the values are only retained for one pass so it's hard to
work with them. It will be incredibly helpful to know whether this is
the right type of use for data() .... and, er, how to take advantage
of it!

Cheers,
Cherry

Reply via email to