您可以使用
$(this)
参考触发按钮。
<script>
var dialog =
function openDialog(el){
var dialog = $("#dialog").dialog({
autoOpen: false,
width: 300,
height: 400,
modal: true,
open: function(event, ui) {
$('#btn-quote').css('z-index',1042);
$('.ui-widget-overlay').on('click', function() {
dialog.dialog('close');
});
},
position: {
my: "center top",
at: "center top+50",
of: el
}
});
dialog.dialog("open");
}
$("#btn-quote, #btn-quote-contact").click(function (e) {
e.preventDefault()
openDialog($(this));
});
</script>