我有一个窗体有两个输入字段。如何比较两个输入值onkey jquery
<input type="text" id="first" value="">
<input type="text" id="second" value="">
我都试过,但没有成功
<script>
$(function(){
var fst=$("#first").val();
var sec=$("#second").val();
if (sec>fst) {
alert("Second value should less than first value");
return true;
}
})
</script>
如何只允许第二输入值只有数字,也低于第一输入少
一些代码examlpes的高度赞赏! –