Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!