我正在使用Wp optin插件,我想在控制盘之前先显示表单。我编写了一些jQuery脚本来隐藏控制盘,并且只首先显示表单,在表单填充后,它将使按钮处于活动状态,单击时将显示控制盘。脚本在控制台窗口上工作,但当我在代码上使用它时,它不会生效。
以下是代码和链接:
jQuery(document).ready(function($){
$("div.wof-wheel .wof-left").hide();
$(\'button.wof-btn-submit\').prop("disabled", true);
$(\'[data-wof-field~="primary_email"]\').on(\'keyup change drop paste\', function(event) {
validateInputs();
});
$(\'[data-wof-field~="text_2"]\').on(\'keyup change drop paste\', function(event) {
validateInputs();
});
$(\'[data-wof-field~="number_1"]\').on(\'keyup change drop paste\', function(event) {
validateInputs();
});
$(\'[data-wof-field~="text_1"]\').on(\'keyup change drop paste\', function(event) {
validateInputs();
});
function validateInputs(){
var disableButton = false;
var val1 = $(\'[data-wof-field~="primary_email"]\').val();
var val2 = $(\'[data-wof-field~="text_2"]\').val();
var val3 = $(\'[data-wof-field~="number_1"]\').val();
var val4 = $(\'[data-wof-field~="text_1"]\').val();
if(val1.length == 0 || val2.length == 0 || val3.length == 0 || val4.length == 0){
disableButton = true;
$(\'button.wof-btn-submit\').attr(\'disabled\', \'disabled\')
}
if(!disableButton){
$(\'button.wof-btn-submit\').prop("disabled", false);
}
}
$("button").click(function() {
$("div.wof-wheel .wof-left").show();
$("div.wof-wheel .wof-right").hide();
$("div.wof-wheel .wof-left").delay(9000).hide(400);
$("div.wof-wheel .wof-right").delay(9000).show(400);
});
});
link