When I press #tax a nothing happens but if I put the variables inside it works but then the pris var changes every time i press #tax a
On 19 Mar, 00:44, James <james.gp....@gmail.com> wrote: > Could you explain what exactly that's not working? > > On Mar 18, 7:41 am, Patrik <patrik.spat...@gmail.com> wrote: > > > Hi! > > > I try to make a script to change the prize between with tax and > > without but I cant get it to work whats wrong? > > > var sant = 'no'; > > var pris = $('#productPrices').html(); > > $('#tax a').click(function(){ > > if(sant == 'no'){ > > var pris2 = pris.replace(/[^0-9.,]+/g, '').replace(/[,]+/g, > > '.'); > > pris2 = parseInt(pris2)*.75; > > $('#productPrices').html(pris2 + ':-'); > > sant = 'yes'; > > }else{ > > $('#productPrices').html(pris); > > } > > return false; > > > });