程序員零花錢碼上賺
一、小小的做個筆記 layer.prompt 實現鍵盤迴車事件
layer.prompt({title: '請輸入數據',
formType: 0, //隱藏用戶輸入內容
// 這個是確定按鈕的事件
"success":function(){
// 鍵盤事件,判斷回車
$("input.layui-layer-input").on('keydown',function(e){
if (e.which == 13) {
alert('你點擊了回車按鈕!'+ $(this).val());
}
//清空輸入框內容: $("input.layui-layer-input").val("");
});
},
// 點擊確定按鈕事件
yes : function(){
// 取輸入框數據
var pass =$(document.getElementsByClassName('layui-layer-input')[0]).val();
alert('你點擊了回車按鈕!'+pass);
//清空輸入框內容: $("input.layui-layer-input").val("");
}
});