javascript - How to copy a value from an input box into the inside of a Jquery Script? -
i want set dynamic value jquery script.
goal: copy value amounter
"amount": "here",
inside script.
here code:
<button id="rzp-button6">pay razorpay</button> <form name='razorpayform'> <input type="text" name="amounter" id="amounter" value=""> </form> <script> var options = { "key": "rzp_test_s7jzhwh0czdxmh", "name": "arijit aich", "amount": "1200", "description": "testing payment", "image": "http://www.google.com/favicon/android-icon-192x192.png", "handler": function (response){ $("#razorpayform").html(response.razorpay_payment_id); var rpid = response.razorpay_payment_id; window.location = '/invoice.php?billno=' + rpid; }, "prefill": { "name": "arijit aich", "email": "xxxxx@gmail.com", "contact": "7121212120" }, "notes": { "shopping_id": "q3123kjanjk" }, "theme": { "color": "#f37254" } } var rzp6 = new razorpay(options); document.getelementbyid('rzp-button6').onclick = function(e){ rzp6.open(); e.preventdefault(); } </script>
jsfiddle: https://jsfiddle.net/00fnopqj/1/
create new razorpay
inside click event handler can set amount property first
$('#rzp-button6').click(function(e){ e.preventdefault(); options.amount = $('#amounter').val(); var rzp6 = new razorpay(options); rzp6.open() }); // or similar in `onclick`
Comments
Post a Comment