我在bootstrap提供的glyphicon铅笔图标上附加了一个onclick事件,然后应该启动一个模态弹出窗口。然而,这似乎在我点击铅笔后直接关闭模态。
$('.overlayed').on('click', '.glyphicon-pencil', function (e) {
//hold the overlayed element for later use
var chartID = $(this).parent().prev().prop('id');;
$('#editWidgetModal').modal('toggle');
//check for onclick event for the save button
$('#edit-widget').on('click', null, function (event) {
//Now assign all textboxes and create an object to pass into the lineBasedChart mutator
var chartEditOptions = {
title: $('#chart-title').val(),
subtitle: $('#chart-subtitle').val(),
yAxis: $('#chart-yAxis').val(),
tooltip: $('#chart-tooltip').val(),
lineWidth: $('#chart-lineWidth').val() == "" ? "" : parseInt($('#chart-lineWidth').val()),
timeWindow: $('#chart-timeWindow').val() == "" ? "" : parseInt($('#chart-timeWindow').val()),
refreshCycle: $('#chart-refreshCycle').val() == "" ? "" : parseInt($('#chart-refreshCycle').val())
};
//set renderTo data attribute to the widgets created element
//overlayedData.data("data-render", chartID);
chart[chartID].SetNewOptions(chartEditOptions);
$('#editWidgetModal').modal('hide');
});
});