我的网站上有一个名字计算器,它计算每个字母的振动,例如:
A是振动1,B是2,C是3,现在,当我在表单中输入一个名字时,我必须按下计算按钮,所以程序计算所有字母的和,并显示总振动。
但是我想让表单动态计算名字的振动,就像你在表格中键入它一样,不需要按下按钮就可以计算出最终振动的总和。
发布于 2016-11-05 10:35:06
发布于 2016-11-05 10:36:49
使用jQuery的keypress函数
$("input").keypress(function(){
//on each keypress in input this function will be executed, calculate your vibration for letters here and append the result in the result field
});键压
https://stackoverflow.com/questions/40437121
复制相似问题