JQuery plugin check hide / show error container

I would like to make error containers invisible and show them only when errors appear (and hide them again when they disappear). What is the easiest way to implement this behavior?

+3
source share
2 answers

The best way to implement this is to use the soul parameter.

The showerrors parameter allows you to define the function by which you want your errors to be displayed. You can manipulate this function to hide and show errors.

here docs

+2
source

Define your error summary in the same way:

<div id='errors' style="display: none;">Sample Error</div>

Use the jQuery.show () method to display the div as:

if (errors == true){
    $("#errors").show()
}

.html() , :

if (errors == specificError){
    $("#errors").html('A specific error has occurred')
    $("#errors").show()
}

, API jQuery - .

EDIT: , jq validate, , , , .

+1

Source: https://habr.com/ru/post/1747434/


All Articles