html structure:
1, <input id="edit-field-14sq-und-0-value" name="field_14sq[und][0][value]" value="" size="12" maxlength="10" class="form-text" type="text"></div>
2, <input id="edit-field-15sq-und-0-value" name="field_14sq[und][0][value]" value="" size="12" maxlength="10" class="form-text" type="text"></div>
3 , <input id="edit-field-16sq-und-0-value" name="field_14sq[und][0][value]" value="" size="12" maxlength="10" class="form-text" type="text"></div>
4 ,<input id="edit-field-17sq-und-0-value" name="field_14sq[und][0][value]" value="" size="12" maxlength="10" class="form-text" type="text"></div>
5 ,<input id="edit-field-18sq-und-0-value" name="field_14sq[und][0][value]" value="" size="12" maxlength="10" class="form-text" type="text"></div>
现在,如果1、2、3、投入箱具有价值,就可以在4、5中划出任何类型。
if the 4, 5, input box has value. then can t type anything in 1, 2, 3.
the following is my test code. but it can t work.
$(document).ready(function(){
$( #edit-field-14sq-und-0-value ).keyup(function() {
if ($( #edit-field-16sq-und-0-value ).val().length > 0) {
alert( you can t type them at the same time );
$(this).val( );
$("#edit-field-15sq-und-0-value").val( );
}
})
});
the keyup function is give an error under firebug.
Edit: added "" to escape single quote in alert();