Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

250
Vistas
How to check and validate duplicate values from onclick event in HTML table through Javascript

[enter image description here][1] [1]: https://i.stack.imgur.com/ONkAu.jpg

function addinfo()
{
    var c_name = document.getElementById("c_name").value;
    var c_mobile = document.getElementById("c_mobile").value;
    var rows_count = document.getElementById("addinfo").rows.length;
    $('#addinfo').append('<tr><td><input type="text" name="in_sr[]" id="in_sr" value="'+ rows_count +'" readonly/></td><td><input type="text" name="in_cname[]" id="in_cname" value="'+ c_name +'" readonly/></td><td><input type="text" name="in_cmobile[]" id="in_cmobile" value="'+ c_mobile +'" readonly/></td>');
}
    table,thead,tr,th,tbody,tr,td{border: 1px solid;}
<html>
    <head>
        <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js"></script>
        <style>
            table,thead,tr,th,tbody,tr,td{border: 1px solid;}
        </style>
    </head>
    <body>
        <label>Name : </label><input type="text" name="c_name" id="c_name">
        </br></br>
        <label>Mobile : </label><input type="text" name="c_mobile" id="c_mobile">
        </br></br>
        <button type="button" name="button" onclick="addinfo()">Add Info</button>
        </br></br>
        <table id="addinfo">
            <thead>
                <tr>
                    <th>Sr.</th>
                    <th>Name</th>
                    <th>Mobile</th>
                </tr>
            </thead>    
            <tbody>

            </tbody>
        </table>
    </body>
</html>

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda