document.addEventListener( 'wpcf7mailsent', function( event ) {
alert("ok");
jQuery('input').focusout(function() {
const label = $(this).parent().parent().find('label');
if (jQuery(this).val() != '') return;
label.animate({
'font-size': '17px',
'top': '10px',
});
})
}, false );
通过单击发送,如果发送成功,插件是否有事件 wpcf7mailsent 那么我想从输入中删除焦点并将标签放置到位,但由于某种原因它不起作用 附:警报工作
这些只是通过点击输入对我有用的功能。这里标签向下和向上
jQuery('input').focus(function() {
const label = $(this).parent().parent().find('label');
if (jQuery(this).val()=='') {
label.animate({
'top': '5px',
'font-size': '75%',
});
}
})
jQuery('input').focusout(function() {
const label = $(this).parent().parent().find('label');
console.log('Value ', jQuery(this).val());
if (jQuery(this).val() != '') return;
console.log('Passed if');
label.animate({
'font-size': '17px',
'top': '10px',
});
})
最佳答案
尝试返回 false 或者您可以在提交按钮(单击)上再次调用 focustout
关于javascript - 提交表单后我的焦点并未从输入中移除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59070764/