1
$(document).ready(function() {
$('#text').live('change', function() {
alert('hello');
});
$('#button').live('click', function() {
$('#text').val('some text');
});
});
<div>
<input type="button" id="button" value="Click Me" />
<input type="text" id="text" />
</div>
버튼을 클릭하면 텍스트 상자 트리거에 change
함수를 어떻게 만들 수 있습니까?자바 스크립트 (jQuery)로 값을 설정할 때 TextBox onchange
$('#button').live('click', function() {
$('#text').val('some text').trigger('change');
});
어느 방법을 사용하여 추가 한 change
event handlers, you can test it here을 트리거 작동합니다
$('#button').live('click', function() {
$('#text').val('some text').change();
});
또는이 : 덕분에