I am trying to make a Form in which there are two Submit buttons. Here is the form.
<form method="POST" id="addCreditsForm">
<div class="row">
<div class="col s12 m10 offset-m1 l10 offset-l1 input-field">
<input type="number" name="amount" id="amount" required/>
<label for="amount">Amount</label>
</div>
<div class="col s12">
<p id="addWithPaypal" style="margin-top:5px;margin-bottom:5px;" class="btn blue">Pay with Paypal</p>
<p id="addWithInstamojo" style="margin-top:5px;margin-bottom:5px;" class="btn blue">Pay with Instamojo</p>
</div>
</div>
</form>
I am trying to do this with JQuery. Here is the JQuery Code.
$(document).ready(function(){
$("#addWithPaypal").click(function(){
$("#addCreditsForm").attr('action'."paypal/add/credits");
$("#addCreditsForm").submit();
});
$("#addWithInstamojo").click(function(){
$("#addCreditsForm").attr('action'."instamojo/add/credits");
$("#addCreditsForm").submit();
});
});
But When I click on any of the elements responsible for calling JQuery functions on Event, JQuery is not working. I tried to fire Alert on click event of both the buttons but it's not working too!
I have no Idea what's wrong. Please Help me out!