I am using the code below to create a jQuery UI Dialog widget dynamically:
$(function () {
var Selector = $(\"a:contains(\'sometext\')\");
$(Sel
A few points to think about:
OnDialogClose you should detach #MenuDialog from DOM to avoid multiple objects with same ID or you can check whether div#MenuDialog exists before adding one.
var Selector = $("a:contains('sometext')"); is a pointless line unless you re-use it else where.
You use $('#MenuDialog') multiple times. It would be better to assign it to a variable instead of querying var Selector = $('#MenuDialog'); all over again .