Function calls in modal dialog
Hi,
I have a modal dialog with the functionality inside to add new form fields to the form in the dialog by clicking on a button in the dialog. This works fine on the first opening of the dialog. If i close the dialog and reopen it again, without refreshing the page, the function to add new form fields doesn't work anymore. My function looks like the following:
- $('.addproductbutton').click(function(event) {
- var count = $('#fieldset-products > *').length
- $.ajax({
- type: "get",
- url: "/addproduct/count/"+count,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- success: function(result) {
- $('#fieldset-products').append(result.html);
- },
- });
- });
Can it have something to do with the ids of the dom objects ?
Some ideas how to solve this ?
Thanks in advance.