How can i Make this Math function work

How can i Make this Math function work

I am trying to create this math function that I seen online but I am getting it wrong. When i try to submit it does nothing.
 
it is supposed to be ... rate + rate/((1+rate)^months)-1) * principal
 
In my code below I have interest as rate,years as months and amount as principal .
 
My code is
 
 
 

 

$('#loan_payment').click(function () {

 

 

$("#years") * 12;

var mat = parseInt($('#interest').val(), 10) + parseInt($('#interest').val(), 10) / (Math.pow("#years"(1 + "#interest") - 1)) * $('#amount');

               

$('#loan_payment_result').val(mat).toFixed(2);

});
 
 
 
 
 
the rest of the code in HTML is correct which is
 

<

table width="420" style="background-color:#CCC;height: 190px;">

 

<tr><td><label>Amount:</label><input type="text" id="amount" /></td></tr>

<tr>

 

<td><label>Interest:</label><input type="text" id="interst" /></td>

</tr>

 
< tr >

<td><label>years:</label><input type="text" id="years" /></td></tr>

<tr>

 

 

<td><input id="loan_payment" value="Submit" type="button" /></td>

</tr>

 

 

<tr>

<td><input type="text" id="loan_payment_result" /> </td></tr>

</table>