title: How to use javascript in codeigniter view page to generate onkeyup event
body: <p>I want to calculate qty*price from give input when price and qty changes automatically total should get changed using javascript events in codeigniter and total filed should be disabled my code is as follow</p>
  
  <pre><code>&lt;script&gt;
  functionn caltotal()
  {
  
  }
  &lt;/script&gt;
  &lt;?php
  echo form_open('add_veg/insert_data', 'class="form-horizontal" id="myform" role="form"');
  $sales_date = array(
          'type'  =&gt; 'date',
          'name'  =&gt; 'date',
          'id'    =&gt; 'date',
          'class' =&gt; 'form-control'
  );
  $vegnames=array();
  foreach($veg_names as $r){
     $vegnames[$r-&gt;value]=$r-&gt;label;
  }
  /*
  $vegnames = array(
          'cauliflower' =&gt; 'Caulifower',
          'Brinjal' =&gt; 'Brinjal'
  );
  */
  $wt = array(
          'type'  =&gt; 'text',
          'name'  =&gt; 'weight',
          'id'    =&gt; 'wt',
          'class' =&gt; 'form-control'
  );
  $price = array(
          'type'  =&gt; 'text',
          'name'  =&gt; 'price',
          'id'    =&gt; 'price',
          'class' =&gt; 'form-control'
  );
  
  $total=array(
              'type'=&gt;'readonly',
              'name'=&gt;'total',
              'id'=&gt;'total',
              'class'=&gt;'form-control disabled'
  );
  $save=array(
          'name' =&gt;'sub',
          'value' =&gt;'Save',
          'class' =&gt;'btn btn-success btn-sm'
  );
  
  echo form_label('Sales date', 'sdate', 'class="control-label col-sm-2"');
  echo form_input($sales_date);
  echo form_label('Vegitable Name', 'vname', 'class="control-label col-sm-2"');
  //echo form_input($veg_name);
  echo form_dropdown('v_name', $vegnames,'','class="form-control"');
  echo form_label('Weight', 'wt', 'class="control-label col-sm-2"');
  echo form_input($wt);
  echo form_label('Price', 'price', 'class="control-label col-sm-2"');
  echo form_input($price);
  echo form_label('Total', 'total', 'class="control-label col-sm-2"');
  echo form_input($total);
  echo form_submit($save);
  echo form_close();
  ?&gt; 
  </code></pre>