Javascript 如果一个府绸在一个地方打开,我可以在另一个地方打开另一个府绸吗?
如果输入无效,我会在输入表单上打开弹出窗口,但是如何让弹出窗口在按钮上打开以提醒人们工作中有错误Javascript 如果一个府绸在一个地方打开,我可以在另一个地方打开另一个府绸吗?,javascript,jquery,validation,input,popover,Javascript,Jquery,Validation,Input,Popover,如果输入无效,我会在输入表单上打开弹出窗口,但是如何让弹出窗口在按钮上打开以提醒人们工作中有错误 const isOpen = (val) => { const num = parseFloat(val); if (isNaN(num)) { return true; } else { const decimals = num.toString().split('.')[1] || ''; if (decimals.length > 2) {
const isOpen = (val) => {
const num = parseFloat(val);
if (isNaN(num)) {
return true;
} else {
const decimals = num.toString().split('.')[1] || '';
if (decimals.length > 2) {
return true;
} else {
return false;
}
}
};
$(document).ready(function() {
$("#submitCalculation").click(function() {
$(".checkVelocity").each(function() {
const val = $(this).val();
if (isOpen(val) || val > 300) {
$(this).popover({
placement: "left",
content: '<textarea class="popover-textarea"></textarea>',
template: '<div class="popover"><div class="arrow"></div>' +
'<div class="row"><div class="col-3 my-auto"><i class="fas fa-exclamation-triangle" id="invalid-input3">' +
'</i></div><div class="popover-content col-9">Enter the velocity of the car between 10 and 300 ms<sup>-1</sup>, kmh<sup>-1</sup> or mph.' +
'</div></div>'
});
$(this).popover("show");
$(this).click(function() {
$(this).popover("hide");
});
}
})
})
})
const isOpen=(val)=>{
const num=parseFloat(val);
if(isNaN(num)){
返回true;
}否则{
常量小数=num.toString().split('.')[1]| |';
如果(小数长度>2){
返回true;
}否则{
返回false;
}
}
};
$(文档).ready(函数(){
$(“#提交计算”)。单击(函数(){
$(“.checkVelocity”)。每个(函数(){
const val=$(this.val();
如果(等参(val)| val>300){
$(这个)({
位置:“左”,
内容:“”,
模板:“”+
'' +
'输入车速在10到300 ms-1、kmh-1或mph之间。'+
''
});
$(此).popover(“显示”);
$(此)。单击(函数(){
$(此).popover(“隐藏”);
});
}
})
})
})
现在我还想打开另一个popover,它悬停在submit按钮submitCalculation上
我该怎么做呢?你能用html创建演示代码吗?