javascript - Calculator Not Working in other browsers -


i have calculator function works in chrome not in other browsers (edge,firefox,explorer,opera). can tell me what's wrong.thanks

<div class="content ticket_wrapper">    <div class="table">      <div class="row header">        <div class="cell">ticket</div>        <div class="cell"><div class="align"> price</div></div>        <div class="cell"><div class="align"> qnty</div></div>        <div class="cell">total</div>      </div>      <div class="row">        <div class="cell">normal</div>        <div class="cell"><div class="align"> ksh 650</div></div>        <div class="cell">            <div class="ticket">              <select oninput="calculate()" id="titotal" class="titotal">                <option value="0">0</option>                <option value="1">1</option>                <option value="2">2</option>                <option value="3">3</option>              </select>            </div>        </div>        <div class="cell">          <span id="result"></span>        </div>      </div>      <div class="row">        <div class="cell">advanced</div>        <div class="cell"><div class="align"> ksh 950</div></div>        <div class="cell">            <div class="ticket">              <select oninput="calculate()" id="titotal_2" class="titotal">                <option value="0">0</option>                <option value="1">1</option>                <option value="2">2</option>                <option value="3">3</option>              </select>            </div>        </div>        <div class="cell">          <span id="result2"></span>        </div>      </div>    </div>    <div class="table_tots">      <div class="row grand_total">          <div class="cell">              sub total :               <span id="grand_total"></span>          </div>      </div>    </div>    <div id="sub">       <input class="submit" type="button" value="proceed">    </div>  </div>

$('#sub').hide();      $('.titotal').on('click', function(event){          var 1 = $('#titotal').val();          var 2 = $('#titotal_2').val();          if (one>0 || two>0) {              $('#sub').show();          }else{              $('#sub').hide();          }      });        function calculate(){          var mybox1 = document.getelementbyid('titotal').value;          var mybox2 = document.getelementbyid('titotal_2').value;          var myresult = mybox1 * 650;          var myresult2 = mybox2 * 950;          var total = myresult + myresult2;          document.getelementbyid("result").innerhtml = myresult;          document.getelementbyid("result2").innerhtml = myresult2;          document.getelementbyid("grand_total").innerhtml = total;        }      window.onload = calculate();

i building table ticket purchasing website

at least firefox, enough change:

<select oninput="calculate()" id="titotal" class="titotal"> 

to:

<select onchange="calculate()" id="titotal" class="titotal"> 

and works. button not necessary then.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -