admin管理员组

文章数量:1122846

I am doing jquery validation on my form which works fine for all fields except for the wp_editor field.

I can set the content like so:

$("#recipe_content").html("<p>Hello</p>");

However validation itself does not work for that field:

$("#recipe-submission-form").validate({
        rules: {
            recipe_title: {
                required: true,
                minlength: 4,
            },
            featured_image: {
                required: true,
            },
            recipe_content: { // DOES NOT WORK
                required: true,
                minlength: 20,
            },
        },
        messages: {
            recipe_title: {
                required: "Please enter a recipe title.",
                minlength: "The title must be at least 4 characters long.",
            },
            featured_image: {
                required: "Please select a featured image.",
            },
            recipe_content: { // DOES NOT WORK
                required: "Please enter the recipe content.",
                minlength: "The content must be at least 20 characters long.",
            },
        },
    });

本文标签: wp editorHow to jquery validate wpeditor