DubFriend / jquery.repeater

Create a repeatable group of input elements
MIT License
390 stars 193 forks source link

Dynamically Assign newly generated name to the if field #50

Closed Mcstabbin closed 7 years ago

Mcstabbin commented 7 years ago

Hello,

I am looking to assign the newly generated id to the name field.

Right now i am assigning that value to a randomly generated number.

Instead of assigning id to random I want to assign it the newly generated name.

Here is my show method:

show: function (){
    $(this).slideDown();
    var random = Math.random();
    // Instead of assigning id to random I want to assign it to the newly generated name
    $(this).find('[id]').attr('id', random);
    $(this).show();

    $('.date-picker').datepicker({
    rtl: App.isRTL(),
    orientation: "left",
    autoclose: true
    });
},
Mcstabbin commented 7 years ago

I solved this.

show: function () 
                {

var formControlName = $(this).find('input.form-control').attr('name') $(this).find('input.form-control').attr('id', formControlName); }