خرید بک لینک

Vote count: 0

Here, on change of a dropdown (values 1-100), the selected number of clones it will add on. I have tried to utilize a couple different variations of selectors, but Im missing something. When I run this code, and a user changes the dropdown in the top div, it adds fields to the second div. I know it is because the classes are the same, how couldve I cloned these to make the divs be separate from each other? The div "NewTeam" is created by cloning based on a selection made earlier. Appreciate the help!

  $(".RosterCountSelect").change(function(){
    var numOfPlayers = this.value;
    c=$('.PlayerRow').length; //How many rows are already shown?
    for (var i = c; i < numOfPlayers; i++){ 
        $(".PlayerRow").first().clone().insertAfter(".PlayerRow:last"); 
    }
});

HTML Markup

 <div class="newTeam">
 <fieldset class="vfb-fieldset vfb-fieldset-1 str8-sports-roster-upload " id = "TeamFieldset" style = "display: none">
  <div class="vfb-legend">
     <h4 style="padding-left: 40px;">New Team - <input id = "TeamName" style = "width:200px" type = "text" placeholder = "Team Name (eg: Girls 5th Grade)"/></h4>
     <label>Roster Count:</label><select class="RosterCountSelect">
     </select>
     <form>
        <table id = "PlayerInfoTable">
           <tr class = "PlayerRow">
              <td><input class="teamInput" type="text" placeholder="Player Full Name" /></td>
              <td><input class="teamInput" type="text" placeholder="Player Number" /> </td>
              <td><input class="teamInput" type="text" placeholder="Jersey Size" /> </td>
              <td><input class="teamInput" type="text" placeholder="Short Size" /> </td>
              <td><input class="teamInput" type="text" placeholder="Male/Female" /> </td>
           </tr>
        </table>
     </form>
  </div>
</fieldset>
 </div>
 <div class="newTeam">
 <fieldset class="vfb-fieldset vfb-fieldset-1 str8-sports-roster-upload " id = "TeamFieldset" style = "display: none">
  <div class="vfb-legend">
     <h4 style="padding-left: 40px;">New Team - <input id = "TeamName" style = "width:200px" type = "text" placeholder = "Team Name (eg: Girls 5th Grade)"/></h4>
     <label>Roster Count:</label><select class="RosterCountSelect">
     </select>
     <form>
        <table id = "PlayerInfoTable">
           <tr class = "PlayerRow">
              <td><input class="teamInput" type="text" placeholder="Player Full Name" /></td>
              <td><input class="teamInput" type="text" placeholder="Player Number" /> </td>
              <td><input class="teamInput" type="text" placeholder="Jersey Size" /> </td>
              <td><input class="teamInput" type="text" placeholder="Short Size" /> </td>
              <td><input class="teamInput" type="text" placeholder="Male/Female" /> </td>
           </tr>
        </table>
     </form>
  </div>
</fieldset>

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 18 فروردين 1395 ساعت: 8:25

صفحه بندی