Let's say I want to create a plugin that convert the input currency. For example, I have a textbox (input) that allows user to input amount of money (in Dollar) and then I will convert it to Riel currency with 4000 of interest rate.
<div>
<label>Amount ($)</label>
<input type="text" id="txtAMOUNT">
<a href="#" id="btnCONVERT">Convert</a>
</div>
<div>
<label>Amount (៛)</label>
<input type="text" id="txtRESULT" readonly>
</div>
<script src="js/jquery.min.js"></script>
<script>
$.fn.toRiel = function() {
var amt = this.val();
return (amt * 4000);
};
$("#btnCONVERT").click(function(e){
var result = $("#txtAMOUNT").toRiel()
$("#txtRESULT").val(result);
});
</script>