Javascript Sweetalert2我可以比较范围输入的值吗?
我有一个从Sweetalert2输入的范围,显示了从50到4000的多个值,在这种情况下,我想将用户输入的值与条件中已经设置的值进行比较,以便代码向用户显示一个带有这些值的警报它需要。该代码仅在确认用户选择的高度之前有效Javascript Sweetalert2我可以比较范围输入的值吗?,javascript,alert,sweetalert2,Javascript,Alert,Sweetalert2,我有一个从Sweetalert2输入的范围,显示了从50到4000的多个值,在这种情况下,我想将用户输入的值与条件中已经设置的值进行比较,以便代码向用户显示一个带有这些值的警报它需要。该代码仅在确认用户选择的高度之前有效 <script> Swal.queue([{ title: 'Hemoglobine/Height Simple Calculator', confirmButtonText: 'Next →', showCancelButto
<script>
Swal.queue([{
title: 'Hemoglobine/Height Simple Calculator',
confirmButtonText: 'Next →',
showCancelButton: true,
text: 'what is the estimated height??',
showLoaderOnConfirm: true,
input: 'range',
inputAttributes: {
min: 50,
max: 4000,
step: 50
},
inputValue: 50,
preConfirm: function(value) {
Swal.insertQueueStep({
type: 'question',
title: 'Hemoglobine/Height Simple Calculator',
confirmButtonText: 'Confirm',
showCancelButton: true,
text: 'Your value is ' + value + ' Height_above_sea_level?',
})
},
allowOutsideClick: () => !Swal.isLoading()
}]).then((result) => {
if (result.value[1] > 1000) {
Swal.fire({
type: 'success',
title: 'Success!',
text: 'The entered values must be reevaluated, subtract -0.2 gr / dL from the hemoglobin values for the new evaluation'
})
}
})
if (result.value[1] > 1500) {
Swal.fire('The entered values must be reevaluated, subtract -0.5 gr / dL from the hemoglobin values for the new evaluation')
}
游泳队([{
标题:“血红蛋白/身高简易计算器”,
confirmButtonText:“下一个&rarr;”,
showCancelButton:true,
文字:“估计高度是多少?”,
请确认:正确,
输入:'范围',
输入属性:{
最小:50,
最高:4000,
步骤:50
},
输入值:50,
预确认:功能(价值){
Swal.insertQueueStep({
键入:“问题”,
标题:“血红蛋白/身高简易计算器”,
confirmButtonText:“确认”,
showCancelButton:true,
文本:“您的值是“+value+”海平面以上的高度”,
})
},
allowOutsideClick:()=>!Swal.isLoading()
}])。然后((结果)=>{
如果(结果值[1]>1000){
喷火({
键入:“成功”,
标题:‘成功!’,
text:'输入的值必须重新评估,从血红蛋白值中减去-0.2 gr/dL对于新的评估'
})
}
})
如果(结果值[1]>1500){
Swal.fire('输入的值必须重新评估,从血红蛋白值中减去-0.5 gr/dL对于新的评估')
}
是否尝试将数组更改为0
如果(结果值[0]>1000)