Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

script/language/method to make form calculate a cost?

  • 12-08-2009 02:04PM
    #1
    Closed Accounts Posts: 411 ✭✭


    basicly i am trying to make my own booking page

    I canmake forms no hassle with drop down menus for options and the like but what i can't do is get each input to add or subtract a value from the total field at the bottom

    I'm not asking anyone to do it for me but if you could point me in the direction of what i should be using to achieve this i can google away and figure it out i hope!


Comments

  • Closed Accounts Posts: 18,152 ✭✭✭✭Liam Byrne


    jQuery
    $("select").onchange(function() {
      totalAmount=0;
      $("select").each(function() {
         totalAmount+=parseInt($(this).val());
      });
      $("#totalField").val(totalAmount);
    });
    


Advertisement
Advertisement