Jquery Repeater Execute a function before creating new row

549 views Asked by At

Hi I have a form that implements jquery-repeater. Code was working fine and somehow it has stopped functioning properly. Basically I have 2 different pages 1 for new form 2nd for editing a form. On new form everything works fine but edit fails.

New Form

Edit Form

For the first button my default text is "Firma Seç" after clicking the "+" button I am executing code below:

iter_sales++; //holds the row count
var seller_btn = $('[name^="group-a"][name$="[seller_button]"]')[iter_sales-1]; //get new button object
seller_btn.innerText = "Firma Seç" // change inner text to default

Same code works for the new-form but on edit-form row is not being created and object returns null due to inbound array index.

Error : Uncaught TypeError: Cannot set properties of undefined (setting 'innerText')

I tried couple of things like sleeping the function wait for row to be created but didn't work. And same code was working before.

EDIT:

Button element:

<button id="maliyet_firma_modal_btn" name="group-a[seller_button]"
                                                    style="width: 120px!important;
min-width: 120px;
max-width: 120px;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" onClick="get_firma(this)" type="button"
                                                    class="btn btn-primary save-button" data-toggle="modal"
                                                    data-target="#demoModal">Firma Seç
                                            </button>
0

There are 0 answers