Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
296 views
in Technique[技术] by (71.8m points)

javascript - 删除前如何显示确认消息?(How to show a confirm message before delete?)

I want to get a confirm message on clicking delete (this maybe a button or an image).(我想获得有关单击删除的确认消息 (可能是按钮或图像)。)

If the user selects ' Ok ' then delete is done, else if ' Cancel ' is clicked nothing happens.(如果用户选择“ Ok ”,则删除完成,否则,如果单击“ Cancel ”,则什么也没有发生。) I tried echoing this when the button was clicked, but echoing stuff makes my input boxes and text boxes lose their styles and design.(当单击按钮时,我尝试回显此内容,但是回显内容会使我的输入框和文本框失去样式和设计。)   ask by Shyam K translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Write this in onclick event of the button:(在按钮的onclick事件中编写以下代码:)

var result = confirm("Want to delete?"); if (result) { //Logic to delete the item }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...