It can be used blur or keyup Event response ;

Achieve one :


<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);" value="123"/>

<input type="text" id="AfterOtOt4" />


<script type="text/javascript" src="jquery-1.8.3.min.js"></script>

<script type="text/javascript">

	$(function() {
$("input[name=inputovertime]").each(function(index, content) {
if ($(content).val() == "" || $(content).val() == null) {
$(content).attr("disabled", "disabled"); // It can't be edited

function check(obj){


$("input[name=inputovertime]").each(function (index, content) {

if(obj!=content){   // If name=inputovertime Of input Element is not an object with the currently entered value

$(content).attr("disabled", "disabled");   // It can't be edited




$("input[name=inputovertime]").each(function (index, content) {

$(content).removeAttr("disabled"); // Initialization can be edited without input





Achieve two :

<input type="text" id="AfterOtOt1" name="inputovertime"/>
<input type="text" id="AfterOtOt2" name="inputovertime"/>
<input type="text" id="AfterOtOt3" name="inputovertime"  value="123"/>
<input type="text" id="AfterOtOt4" />
<script type="text/javascript" src="jquery-1.8.3.min.js"></script>
<script type="text/javascript">

        $(function () {
$(content).attr("disabled", "disabled");   // It can't be edited
})             $("input[name=inputovertime]").keyup(function () {
                if ($(this).val().length > 0) {
                    $(this).siblings("input[name=inputovertime]").attr('disabled', "disabled");// Will divide current name=inputovertime Other than the input value name Is the... With no input value input The element is set to disabled;
                else {
                    $(this).siblings("input[name=inputovertime]").removeAttr('disabled');   //  Will divide current name=inputovertime Of which no value has been entered name=inputovertime Of input The element is set to be editable ;
        })     </script>

Many are the same name The text input box for , After entering one of them , So that the rest can not enter the value of more related articles

  1. solve Vue Chinese text input box v-model The data is not displayed after bidirectional binding

    Preface One of the problems encountered in the project is Vue When binding object properties in both directions , After manually assigning attributes, the data in the input box is not updated in real time . <FormItem label=" Address " prop="eve ...

  2. Text input box input Convert input to uniform case

    Reprinted address : Text input box input Convert input to uniform case , There are usually two ways :JS and CSS Method . 1 ...

  3. html The text input box is not allowed to record input records , single click input The entered record appears

    In fact, the method is very simple , Only need input Add a line to the text input box autocomplete="off" Attribute is enough . <input type="text" name=&qu ...

  4. Qt The user-defined text input box supports two input formats: degree, minute, second and degree ( Simple unlimited input )

    1. Custom text input box #ifndef MYLINEEDIT_H #define MYLINEEDIT_H #include <QLineEdit> #include "ui_my ...

  5. Text input( Text input box )

    Text input( Text input box ) It's a great way to get user input . You can create : <input type="text"> Be careful ,input The element is self closing .

  6. JS Text input box magnifying glass effect

    JS Text input box magnifying glass effect I studied this afternoon " Text input box magnifying glass effect " Of course KISSY The official website also has this component Please have a look at kissy demo In fact, this effect For many children's shoes It should be no stranger ! I am now ...

  7. HTML in &amp;lt;input&amp;gt; Parameters , And text input boxes , The explanation of text field

    <form> <input type="text/password" name=" name " value=" Text " /> ...

  8. Python Implementations use tkinter Pop up the input box and enter the number , It has the function of confirming input and clearing

    Python3.6 of use tkinter, Pop up the input box where you can input numbers . # Copyright (c) 2017-7-21 ZhengPeng All rights reserved. def pop_u ...

  9. Real time monitoring text box input oninput、onchange And onpropertychange The usage and difference of events

    In many cases of front-end page development, you need to monitor the text box input in real time , For example, Tencent Weibo writing 140 The input box of the word microblog hu9i Dynamic display can also enter the number of words . It was used in the past onchange/onkeyup/onkeypress/onke ...

Random recommendation

  1. Make one App A few things to consider before you go to work

    Make one App A few things to consider before you go to work   source :limboy The blog of   With the improvement of tool chain , Language upgrades and the emergence of a variety of quality tutorials , Make one App It's getting cheaper and cheaper . For all that , Some things are best done in the early stage , Avoid when ...

  2. EXT learning ——EXT The drop-down box is bound to the first value by default

    // The default value of the first drop-down box is if ( != undefined) { this.moduleCombo.setValue(this.modu ...

  3. Everyone can develop highly available and scalable applications &mdash;&mdash; On Azure Service Fabric The meaning of

    Today's recommended article is actually an official announcement of Microsoft , Announced its upcoming release of a framework to support highly available and scalable cloud services --Azure Service Fabric. Two days before , Microsoft Azure Platform CTO Mark Russinovi ...

  4. pragma pack( Very useful byte alignment instructions )

    Emphasize a little : #pragma pack(4) typedef struct { char buf[3]; word a; }kk; #pragma pack() The principle of alignment is min(sizeof(wor ...

  5. Linux Local network script configuration ( Intranet and extranet )

    The script is located in the :     /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 // Name of network card BOOTPROTO=static // none static state IP ...

  6. NRF51822 The module does not recognize the solution to the problem

    I know no one's looking at a picture , So I took a few random blind screenshots . For many new friends , Maybe I don't know much about jtag Some necessary circuits for debugging , It's like a lot of people don't like to use stm32 The hardware i2c, But like software io simulation , Even if it's used ...

  7. Python Chapter viii. ( Beili National Excellent Course Song Tian and so on )

    Programming method 8.1 Examples of sports analysis from random import random def printIntro(): print(" This program simulates two players A and B Some kind of athletic competition " ...

  8. function select、poll

    function select select function : int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct ...

  9. Use timer judgment to ensure that a tag has a value before executing the method , control js Code execution sequence

    Use timer judgment to ensure that a tag has a value before executing the method : var wait = setInterval(function(){ var diqu = $("#diqu").val(); // Make sure ...

  10. hbase java api Examples ( edition 1.3.1, new API)

    hbase edition :1.3.1 Purpose :HBase new API How to use . Try and verify the following java api How to use . 1. Create table 2. Create table ( Pre partition ) 3. Single insertion 4. Batch insert 5. Batch insert ( The client is slow ...