V
V
viktorleg2021-09-16 02:03:28
WordPress
viktorleg, 2021-09-16 02:03:28

How to display a notification immediately after pressing the save button?

I made a form on the site where the user can change information about himself.

If the user has not filled in all the fields, then a notification appears at the top asking you to fill in all the fields.
The problem is that when you fill in all the fields and click the save button, the notification does not disappear until you refresh the page, and just the opposite, when you clear all the fields, it does not appear until the page is refreshed.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
viktorleg, 2021-09-16
@viktorleg

Solved the issue by placing a notification inside the function

D
Daskus, 2021-09-16
@Daskus

You can use Javascript to control the display of the notification text container.
For example:

document.querySelector('#your-button-selector').addEventListener('click', function(){
    document.querySelector('#notice-container').style.display = 'none';
}, false);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question