I have this in my Form
<%= f.label :price, "price"%>
<%= f.text_field :price, :size=>20, :id =>"price" %>
<%= f.label :quantity, "Quantity"%>
<%= f.text_field :quantity, :size=>20, :id =>"qty" %>
<%= f.label :amount, "Amount"%>
<%= f.text_field :amount, :size=>20, :id =>"amount"%>
I want {price*quantity} to happen inside the 'amount' field as soon as i enter values inside 'price' and 'quantity' i.e calculations should happen before submit. I am new to jQuery/Ajax, so any help will do. Thanks in advance.
You can do something like this
But you have to give the amount field the id "amount" and not reuse "price" as the id.