I have some <div>
tags created by Javascript each having different "id" and "class" attribute.
Some samples of div tags
<div id="demoid1" onclick="javascript:openDialog(this)" class="demoClass1">demoTag1</div>
<div id="demoid2" onclick="javascript:openDialog(this)" class="demoClass2">demoTag2</div>
<div id="dialog-1" title="Test Case Details">
<P>This my first jQuery UI Dialog!</P>
</div>
Code done so far:
function openDialog(ev) {
var docid= ev.id;
$(function () {
$("#dialog-1").dialog({
autoOpen: false,
});
$("#"+docid).click(function () {
$("#dialog-1").dialog("open");
});
});
}
Please help.
Update:
I have such 10-15 <div>
tags and each one different ID.
I want those <div>
tags to be clickable and on click it will pop up a small display window.
Before I needed the ID of the element clicked so that I can fetch information dynamically from JSON so that I can display the information.