I would use a common class for the buttons and dialogs, and a data-
attribute to specify the dialog div:
<button class="help-button" data-dialog-id="#HelpDialog6">?</button>
<div id="HelpDialog6" class="help-dialog">Some content</div>
$(function () {
$(".help-dialog").dialog({
width: 400,
autoOpen: false
});
$('.help-button').click(function () {
$($(this).data('dialog-id')).dialog("open");
return false;
});
});