How to start an OnClick event for an UI Dialog in JQuery dynamically ?
Every SVG-rect element (1,2,...,1000) should be able to open this dialog, while a parameter or ID should be submitted as well to identify which svg was clicked.
The relevant JS code looks like this:
$(function() {
$( "#request_1" )
.click(function() {
createForm();
$( "#dialog-form" ).dialog( "open" );
});
/*....*/
};
The relevant HTML Code looks like this:
<svg version="1.1" width="720" height="125">
<rect id="request_1" x="180.5" y="15" width="39" height="15">
</rect>
</svg>
<svg version="1.1" width="720" height="125">
<rect id="request_2" x="180.5" y="15" width="39" height="15">
</rect>
</svg>
/*[...]*/
<svg version="1.1" width="720" height="125">
<rect id="request_1000" x="180.5" y="15" width="39" height="15">
</rect>
</svg>
The problem comes from this example where you can find the full source code: http://jqueryui.com/dialog/#modal-form
Imagine you would have 1000 different buttons.
Any idea? I guess using a simple onClick would be a solution, but how to start the .click(function()) then?
Thank you for helping me!