$("#text").on("propertychange change keyup paste input", function() {
var currentVal = $(this).val();
if(currentVal == oldVal) {
return;
}
oldVal = currentVal;
alert("changed!");
});
하지만 여기서 input을 넣으니 2번씩 감지한다. 그러므로 제외해서 쓰기로 했다 일단.
$("#text").on("propertychange change keyup paste", function() {
var currentVal = $(this).val();
if(currentVal == oldVal) {
return;
}
oldVal = currentVal;
alert("changed!");
});
input 박스에 원하는 길이만큼 채워진 후 다음 이벤트를 설정하고싶을 때
1 2 3 4 5 6 7 8 9 | $("#certNum").keyup(function() { if (this.value.length >= 6) { var temp = this.value.substring(0, 6);
$(this).val(temp); $("#certOkBtn").trigger("click"); } }); |