jQuery script - Field based on quantity input

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 431 Views - Last Post: 18 October 2019 - 05:24 AM

#16 kinigakos   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 16-October 19

Re: jQuery script - Field based on quantity input

Posted 18 October 2019 - 03:46 AM

I've wrote a function where every time i change the color(variation) the quantity input resets to 0 so it works.

If i change the value to
var print_price = '15.65';
for example the result i get is 16. Is this because of parseFloat
var print_product_total = parseFloat(print_price * this.value);
?
Was This Post Helpful? 0
  • +
  • -

#17 kinigakos   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 16-October 19

Re: jQuery script - Field based on quantity input

Posted 18 October 2019 - 03:57 AM

My bad i didn't notice that there was a toFixed(2)method in
('#print_total_price .print_price').html( currency + print_product_total.toFixed(2));

This post has been edited by Dormilich: 18 October 2019 - 04:03 AM

Was This Post Helpful? 0
  • +
  • -

#18 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4244
  • View blog
  • Posts: 13,449
  • Joined: 08-June 10

Re: jQuery script - Field based on quantity input

Posted 18 October 2019 - 04:04 AM

View Postkinigakos, on 18 October 2019 - 12:46 PM, said:

I've wrote a function where every time i change the color(variation) the quantity input resets to 0 so it works.

Isn't that inconvenient for the user to set the quantity again each time he changes the color?
Was This Post Helpful? 0
  • +
  • -

#19 kinigakos   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 16-October 19

Re: jQuery script - Field based on quantity input

Posted 18 October 2019 - 04:24 AM

You are right but since i'm new in jQuery and not able to write the script the way you suggested i must go on with this solution.
Was This Post Helpful? 0
  • +
  • -

#20 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4244
  • View blog
  • Posts: 13,449
  • Joined: 08-June 10

Re: jQuery script - Field based on quantity input

Posted 18 October 2019 - 04:43 AM

Well, you never posted your attempts at that... so we couldn't point out the problems.
Was This Post Helpful? 0
  • +
  • -

#21 kinigakos   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 16-October 19

Re: jQuery script - Field based on quantity input

Posted 18 October 2019 - 05:24 AM

Thank you for your help so far. I appreciate it. I never posted any attemps because i didn't exactly understood your answer on how the script should be and everything that i tried didn't work.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2