I have two buttons and if I click on some button I need to change value in input text and change total price (product price * value of button - 2 or 4 Qty).
I know
My Attempt ( JsFiddle)
Javascript
$(document).ready(function () { $('#buttons input[type=button]').on('click', function () { var qty = $(this).data('quantity'); var price = $('#totalPrice').text(); $('#count').val(price * qty); }); });
Html
Product price:$500 Total price: $500 Total