How to make a pop-up tip automatically close in 2 seconds
I want the “alert(”Existing table header“);” to disappear automatically in 2 seconds!
I found a code from the internet and it doesn't seem right.
$(document).ready(function() {
// Show warning box
$("#alert-box").fadeIn(500, function() {
// Automatically turns off after a certain period of time (e.g. 3 seconds)
setTimeout(function() {
$("#alert-box").fadeOut(500);
}, 3000); // 3000 milliseconds = 3 seconds
});
});
My original code.
var cell = app.activeDocument.selection[0].parent;
var myTable = cell.parent;
firstRow = myTable.rows[0];
//add 1 row at the table top
if ((firstRow.rowType !== RowTypes.HEADER_ROW) && (myTable.rows[0].cells[0].contents !==contName))
{
dupeTopRow(myTable);
myTable.rows.add(LocationOptions.BEFORE, myTable.rows[0]);
/**
* duplicate the first row af a myTable
* @ param the myTable
* @ return void
*/
function dupeTopRow(t){
var newRow = t.rows.add(LocationOptions.BEFORE, t.rows[0]);
var newCell = newRow.cells
var lr = t.rows[1].cells
for (var i = 0; i < newCell.length; i++){
newCell[i].properties = lr[i].properties;
};
}
}
else{
alert("Existing table header ")
exit ();
}Thnak you very much.
