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

150
Views
Repeat input type file by taking integer input from user

So, basically i have a textbox and file upload button . What i want when user enter integer in textbox for eg :10 then i want to display file upload button 10 times.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Here is a working demo hope it will helpful for you.

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
 
function AppendRow(e) {
    var val = e.value;
    if (val !== "") {
      var html ='';
        for (var i = 0; i < val; i++) {
          html +='<input type="file" id="file">';
        }
     $("#append").empty().append(html);
    }
}
</script>
</head>
<body>
 

<input  type="text" id="input1" onkeyup="AppendRow(this)"/> 
 <div id="append">
 
 <div>
 
</body>
</html>

about 4 years ago · Juan Pablo Isaza Report

0

    <!DOCTYPE html>
    <html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
    
        $(document).ready(function(){
    $("input").keyup(function(){
    var val = $(this).val();
        if (val !== "") {
          var html;
            for (var i = 0; i < val; i++) {
              html = '<input type="file" id="file">';
              $("#append").append(html);
            }
         
        }
    });
});
    </script>
    </head>
    <body>
     

    <input  type="text" id="input" /> 
     <div id="append">
     
     </div>
     
    </body>
    </html>
about 4 years ago · Juan Pablo Isaza Report

0

Please use the following code

<input [(ngModel)]="count" />
<div *ngFor="let item of [].constructor(count); ">
  <input type='file'>
</div>

about 4 years ago · Juan Pablo Isaza Report
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!