ArtemKrass,
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript'>
$(function () {
$("body").on('input', '#1:not(.disabled)',
function () {
if (this.value.length > 0) {
$('#2').addClass('disabled').prop("readonly", true);
} else $('#2').removeClass('disabled').prop("readonly", false);
jQuery('#2').val(this.value)
}
).on('input', '#2:not(.disabled)', function () {
alert('Hello');
});
});
</script>
</head>
<body>
<input type="text" id="1" name="1" value="" size="12" maxlength="10" class="form-text required">
<br />
<input type="text" id="2" name="2" value="" size="12" maxlength="10" class="form-text required">
</body>
</html>