I have a page with a variable number of items (generated by Django, if that makes a difference), each of which with an open-able/close-able help dialog made with JQuery-ui. Currently, however, I cannot figure out how to open ONLY the correct help dialog when I click the corresponding button. With what I have right now (only referencing the class in my script), it opens every help dialog when you click any help button. What I am doing now is creating all the dialogs on the page load and then displaying only on a click. I think it would make sense to display the correct dialog based on IDs, but I have no idea how to incorporate that into the script.
HTML: (example based off dynamically generated content)
<li>
<div class="help_expander"></div>
<p class="toggled_helptext"><!--Text for the dialog--></p>
<!--Actual content of the item-->
</li>
<li>
<div class="help_expander"></div>
<p class="toggled_helptext"><!--Text for the dialog--></p>
<!--Actual content of the item-->
</li>
javascript:
$(document).ready(function() {
$("input[type=submit], input[type=button]").button();
$(".toggled_helptext").dialog({
autoOpen: false,
title: "Help"
});
$(".help_expander").click(function() {
$(".toggled_helptext").dialog('open');
return false;
});
});
firstHelporsecondHelp