Solved my own problem (again). For anyone else with a similar question, just add a hidden field to your dialog form:
<div id="new"> ... <input type="hidden" value="" id="id" /> </div> Then, in the click event, add: $("#id").val(id); after the dialog('open') line. The final result is: var opt = { autoOpen: false, modal: true, buttons: { 'Show ID': function() { var id = $("#id").val(); alert("ID: "+id); // This works! }, Cancel: function() { $(this).dialog('close'); } }, }; $("#new").dialog(opt); $('a.plu').click(function() { var id = $(this).attr('id').split('_')[1]; $('#new').dialog('open'); $("#id").val(id); });