Pal*_*avi 5 html javascript jquery jsp
我有一些HTML代码以及脚本代码.我需要解决方案来处理一个文本框的更改事件,该文本框禁用在另一个文本字段中输入数据的行为.任何人都可以帮助我.
<div id="cca" class="leaf">
<label class="control input text" title="">
<span class="wrap">cca</span>
<input class="" type="text" value="[Null]"/>
<span class="warning"></span>
</label>
</div>
<div id="ccit" class="leaf">
<label class="control input text" title="">
<span class="wrap">ccit</span>
<input class="" type="text" value="[Null]"/>
<span class="warning"></span>
</label>
</div>
Run Code Online (Sandbox Code Playgroud)
$(document).ready(function () {
alert("hello");
$("#cca").on('change', 'label.control input', function (event) {
alert('I am pretty sure the text box changed');
$("ccit").prop('disabled',true);
event.preventDefault();
});
});
Run Code Online (Sandbox Code Playgroud)
Tre*_*vor 10
对于你遗失#的人$("ccit")
$(document).ready(function () {
alert("hello");
$("#cca").change(function(){
alert('I am pretty sure the text box changed');
$("#ccit").prop('disabled',true);
event.preventDefault();
});
});
Run Code Online (Sandbox Code Playgroud)
更新
$(document).ready(function () {
$("#cca").on('change', 'label.control input', function (event) {
alert('I am pretty sure the text box changed');
$("#ccit").find('label.control input').prop('disabled',true);
event.preventDefault();
});
});
Run Code Online (Sandbox Code Playgroud)
更新2
$(document).ready(function () {
$(document).on('change', '#cca label.control input', function (event) {
alert('I am pretty sure the text box changed');
$("#ccit").find('label.control input').prop('disabled',true);
event.preventDefault();
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
73379 次 |
| 最近记录: |