Can respond with blur or KeyUp events;
Implement one:
<body>
<input type= "text" id= "AfterOtOt1" name= "Inputovertime" onkeyup= "Javascript:check (this);"/>
<input type= "text" id= "AfterOtOt2" name= "Inputovertime" onkeyup= "Javascript:check (this);" />
<input type= "text" id= "AfterOtOt3" name= "Inputovertime" onkeyup= "Javascript:check (this);" />
<input type= "text" id= "AfterOtOt4"/>
</body>
<script type= "Text/javascript" src= "Jquery-1.8.3.min.js" ></script>
<script type= "Text/javascript" >
function Check (obj) {
if (obj). val ()! = "") {
$ ("input[name=inputovertime]"). each (function (index, content) {
if (obj!=content) {//If the Name=inputovertime INPUT element is not an object of the currently entered value
$ (content). attr ("Disabled", "disabled"); Not editable
}
})
}else{
$ ("input[name=inputovertime]"). each (function (index, content) {
$ (content). REMOVEATTR ("Disabled"); Editable when initialization is not entered
})
}
}
</script>
Implementation two:
<body>
<input type= "text" id= "AfterOtOt1" name= "Inputovertime"/>
<input type= "text" id= "AfterOtOt2" name= "Inputovertime"/>
<input type= "text" id= "AfterOtOt3" name= "Inputovertime"/>
<input type= "text" id= "AfterOtOt4"/>
</body>
<script type= "Text/javascript" src= "Jquery-1.8.3.min.js" ></script>
<script type= "Text/javascript" >
$ (function () {
$ ("input[name=inputovertime]"). KeyUp (function () {
if ($ (this). Val (). length > 0) {
$ (this). Siblings ("Input[name=inputovertime]"). attr (' disabled ', "disabled");//will be in addition to the current name= Inputovertime the input value is set to Disabled if name is an INPUT element that does not enter a value;
}
else {
$ (this). Siblings ("Input[name=inputovertime]"). Removeattr (' disabled '); Sets the input element of the name=inputovertime, except for the current Name=inputovertime value, to editable;
}
})
</script>
Multiple text input boxes of the same name, enter one after, so that the remaining cannot enter the value