我想在Javascript confirm()函数中显示文本行:
第1行:¿你真的想要取消手术吗?
2ND行:所有输入的数据将丢失');
$('#button').click(function () {
return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION? ALL ENTERED DATA WILL BE LOST');
});
DEMO:http://jsfiddle.net/8jEZZ/
谢谢。
答案 0 :(得分:24)
添加\n
,魔法将会发生!
$('#button').click(function () {
return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION? \n ALL ENTERED DATA WILL BE LOST');
});
答案 1 :(得分:0)
尝试换行符,工作fiddle
$('#button').click(function () {
return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION?\n ALL ENTERED DATA WILL BE LOST');
});
答案 2 :(得分:0)
使用换行符
$('#button').click(function () {
return confirm('¿DO YOU REALLY WANT TO CANCEL THE OPERATION? \nALL ENTERED DATA WILL BE LOST');
});