Thank you Jacob Peattie for suggesting. It is very simple to use confirm() to replace alert() although confirm() has two options for users to select: OK and Cancel.
When users click OK or Cancel button, I use function focus() to direct users where to correct that empty Content. Here are my working sample codes:
if(content === '') {
confirm('Please write description of your post.');
tinymce.activeEditor.focus(); // for Visual Mode of WP Classic Editor
$('#content').focus(); // for HTML Mode of WP Classic Editor
}
Many thanks
Related Posts:
- Validating input using java.util.Scanner
- What is the actual minimum length of an email address as defined by the IETF?
- Server side validation
- Does wp_insert_post validate the input?
- WordPress oEmbed W3C Validation
- How to Remove novalidate attribute from comment form
- What is wp_check_invalid_utf8?
- Data Validation
- Data Validation: Always escape late / escape HTML Code
- Multiple register settings, with same option name – issue
- Inconsistent server code response using HTTP API
- wordpress site validation errors
- Data validation
- Best Practice for Validating and Sanitizing Data
- Does balanceTags() provide any escaping / protection?
- w3c validation problem – Twitter share button pulling content
- Data sanitization for user registration and user login
- wp_remote_post – handling responses
- What data sanitzation function should be used to store entire source code of webpage?
- protect user submitted posts
- Settings API – getting hidden input / submit button’s name
- Why the WP Core team does not allow filter_* functions? [closed]
- confused about sanitize_email after is_email [duplicate]
- Require user to input code from an array of allowed codes with Gravity Forms [closed]
- Output Sanitation
- How do I sanitize the str_replace function in javascript variables
- WordPress live, custom text box validation, how to?
- How to do more than one verify_nonce in one function?
- W3C validation errors (trailing slashes)
- Jquery Validation Engine with Conatct Form 7
- Gravity Forms validate arrival and departure
- Why is my script’s regex having its backslash removed?
- Validation Always Tells There Is an Open DIV
- How long does plugin review usually take?
- WP calendar summary attribute validation error
- How can I validate an email address using a regular expression?
- WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery
- Email validation using jQuery
- How to validate date with format “mm/dd/yyyy” in JavaScript?
- jQuery Form Validation before Ajax submit
- In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
- don’t publish custom post type post if a meta data field isn’t valid
- Replacing the WordPress password validation
- edit profile validation refreshes all field if missing wordpress
- Validation Function for URL in plugin
- How to reload the role specific registration form on validation errors?
- WordPress & W3C CSS Validation
- Require a Custom Taxonomy to be checked
- Error in Validate Field with ACF plugin in WordPress
- jQuery Validate wp_editor
- How to validate register settings array
- Check if username exist with AJAX
- How can i add validation to this login form with out it redirecting to the wp-login.php page
- Duplicate attribute class causing site validation error
- How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?
- vs WordPress Security
- Alternative to esc_textarea
- Form validation in WordPress Admin Panel
- WordPress-gutenberg – Block validation: Expected text
- Validate Uploaded Image using WordPress’ Built-in Functions?
- wooCommerce checkout page State / County (optional) validate not working
- How to force field validation first, then its values saved durning edit profile?
- What esc_ to use to validate this?
- Unable to sanitize in customizer and escape in theme without removing ability for user to use “< br >” to insert a line break
- Add ALT attribute to Pin It Button image to pass HTML5 validation
- don’t publish custom post type post if a meta data field isn’t valid
- Display all WP Errors together during form validation
- Can a shortcode included in post content add styles to the ?
- Is it necessary to do validation again when retrieving data from database?
- allow only lowercase user registrations
- How to add fields in custom registration form, validate it and aave to db? [closed]
- How WordPress sanitizes post content on save? Or it doesn’t?
- Remove comments validation (remove filter?)
- How to validation for sanitize_URL?
- WordPressUser Submission Form
- Front end post form validation
- WP Rest API – Change response status code for failed validation request
- How do I change the text content of a div for a comment validation error message?
- How do I add a 5 digit ZIP code validation to a Contact7 form?
- What’s the right way to validate JSON data coming from an AJAX POST request?
- Change pubDate in rss feed in another format
- How to use third-party SendGrid Email Validation API in Gravity Forms?
- jQuery Validation plugin and Bootstrap 4 CSS classes
- Restrict certain roles registrations by domain
- WordPress login form with fancybox
- Help with WordPress RSS Validation Error
- How to bypass Woocommerce checkout validation from the plugin? [closed]
- Displaying errors on the front end from my plugin
- Proper Way to Sanitize Meta Input
- Can we validate user email changes?
- register_setting – validation callback weirdness
- Form validation on user profile edit
- Block pattern conflict with custom block
- jQuery Live Form Validation in WordPress
- How to use esc_attr__() function properly to translate a variable that contains string?
- How to do Conact form 7 name field validation? [closed]
- Custom WP Rest API Endpoints from JSON Schema
- woocommerce_add_to_cart_validation max quantity depending on user geoip [closed]
- Gallery Block in template, validation fails after adding column number
- jQuery – Make multiple field Required with warning at WP Admin backend