I have some HTML setup like this:
<div>
<label for="amount"><a id="amount-help-icon" class="help icon-link" href="#"><span class="ui-icon ui-icon-help"></span></a> Amount:</label>
<input id="amount" class="inputText" type="text" value="" maxlength="100" size="10" name="amount" />
<span class="help">The amount for stuff</span>
</div>
I am trying to have jquery display a dialog when the help icon is clicked, so I have this:
$("a.help").click(function () {
$(this).closest("label").siblings(".help").dialog({ title: "Help" });
return false;
});
It works fine to display the dialog the first time, but the span disappears from the DOM when I click the icon. So, if I click the icon again, nothing happens (because there is no span.help to find).