Search code examples
javascriptjqueryjqmodal

jqModal close, reopen issue


A Jquery Modal is called with two form elements. There is also an option to close the modal. One scenario is that the user would close the modal, and can come back to it.
But when the user come back, the form elements do not work, and the modal just closes upon a click.

   $('#test').jqmAddClose('#test');

My assumption is that when the modal closes, it destroys the elements. Thus behaving erratically.

I tried Hiding the modal rather than closing it, but this does not remove the overlay.

The other option is to assign a unique for each instance.

Any other suggestions.

Thank you.


Solution

  • The issue was as I noted in the question, browser deleting the elements, and not re creating them. Assigning a new id each time modal was called solved the problem.