I am using a jQuery UI Modal Box.
I have a sidebar which has different controls like button, selectbox etc. I am dragging a control from my side bar which adds a BUTTON on my CMS page. When user click on that button then a jQuery Modal window open which is fine. But issue arises when user repeat this process and drag the code snippet again. In that case the Modal window cannot open second time due to the ID MisMatch.
I found a solution on same website at this link:
See the accepted solution. It works fine for me also but I need one change to make it dynamic according to my application:
That example uses two button controls
<button id='create-explanation1' class='btndialog' data-target="dialog-message1">Explanation</button>
<button id='create-explanation2' class='btndialog' data-target="dialog-message2">Explanation</button>
Whereas I want to use above button code one time and add an auto-increment variable with data-target value, so that I will get
dialog-message1, dialog-message2, dialog-message3 etc whenever user drag a code snippet from sidebar.
Means: If user drag a BUTTON first time then I need data-target="dialog-messag
e1", if user drag a button second time then I need data-target="dialog-messag
Need urgent help