Home > Web Front-end > JS Tutorial > jQuery Validate cannot verify the chosen-select element. How to solve it

jQuery Validate cannot verify the chosen-select element. How to solve it

小云云
Release: 2018-01-12 09:17:36
Original
2309 people have browsed it

This article mainly introduces the solution to the problem that jQuery Validate cannot verify the chosen-select element. Friends who need it can refer to it. I hope it can help everyone.

After the choosen-select element executes the choose() method, it adds style="display: none;" to the select element to hide it, and then reconstructs a drop-down list that looks like select.

And jQuery Validate ignores verification of hidden elements by default, so we need to exclude select. Add the ignore attribute to the parameters of the validate() method to remove the select from the ignored hidden elements.


$("select").validate({ignore: ":hidden:not(select)"});
Copy after login

:hidden selector selects hidden elements. Elements in the following situations are hidden elements:

  • Set to display:none

  • ##Form elements with type="hidden"

  • width and height set to 0

  • Hidden parent element (this will also hide child elements)


Note: This selector has no effect on elements with visibility: hidden and opacity: 0.

Related recommendations:

Chosen jquery-based selection box plug-in usage method_jquery

##Jquery choosen dynamic setting value example introduction_jquery

jquery select plug-in asynchronous real-time search implementation method

The above is the detailed content of jQuery Validate cannot verify the chosen-select element. How to solve it. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template