1
我想知道我怎麼可以只允許在這部分數字。我怎樣才能讓數字只在斯瓦爾Sweetalert
{
title: "Dollar Amount?",
text: "How much is your Dollar Question worth?",
inputPlaceholder: "Enter Amount"
}
我正在使用Sweetalert插件。它已經困擾了我好幾天,我只是新的前端,我真的是一個完整的後端人。
function showDollarQuestion() {
if (inUserId === "" || inUserId === null) {
socket.emit('stud notif', myuserid,myuserid,"noroom");
}else{
swal.setDefaults({
input: 'text',
confirmButtonText: 'Next →',
showCancelButton: true,
animation: false,
progressSteps: ['1', '2']
})
var steps = [
{
title: "Dollar Question?",
text: "Ask a question to your influencer",
inputPlaceholder: "Write your Dollar Question"
},
{
title: "Dollar Amount?",
text: "How much is your Dollar Question worth?",
inputPlaceholder: "Enter Amount"
}
]
swal.queue(steps).then(function (result) {
if (result[1] === "" || result[1] === "") {
swal.resetDefaults()
swal({
title: 'Empty Field!',
html:
'Dollar Question is required<br />Dollar Amount is required',
confirmButtonText: 'Try Again',
showCancelButton: false
})
}else if(){
}else{
swal.resetDefaults()
swal({
title: 'All done!',
html:
'Your Dollar Question is '+JSON.stringify(result[0]).replace(/\"/g, "")+
'<br /> Dollar Question worth is '+JSON.stringify(result[1]).replace(/\"/g, ""),
confirmButtonText: 'Great, your question has been successfully submitted to your influencer',
showCancelButton: false
})
socket.emit('dollar quest', JSON.stringify(result[0]).replace(/\"/g, ""), JSON.stringify(result[1]).replace(/\"/g, ""), inUserId, myuserid, 'dquest');
}
}, function() {
swal.resetDefaults()
})
}
}
到目前爲止,這是我得到的所有代碼。我找不到有關Sweetalert的任何教程。在此先感謝球員
喜先生,所以我怎麼能做到多輸入?因爲我的原因我有一個數組類似的東西,他們都設置爲默認爲'''input:'text'''' – TheGinxx009
https://sweetalert2.github.io/#multiple-inputs –