vave
Полезный
- Регистрация
- 22 Июн 2007
- Сообщения
- 467
- Реакции
- 16
- Автор темы
- #11
Thank you for your answer, but it does not work...You could add a class to both of your inputs and execute the function on keyup event. Not tested, but something like this should work.
HTML:<input class="myinputselector" type="text" name="txtPer" id="txtPer" value="" > <input class="myinputselector" type="text" name="txtAmt" id="txtAmt" value="" >
Код:$(".myinputselector").keyup(function() { let amt = $("#txtAmt").val(); let per = $("#txtPer").val(); if(amt !== "" && per !== "" && !isNaN(amt) && !isNaN(per)){ let res = (amt/100) * per; $("#skb-res").html(res); } else { $("#skb-res").empty(); } });