Home  >  Article  >  Web Front-end  >  What to do if jquery control fails

What to do if jquery control fails

藏色散人
藏色散人Original
2021-11-11 09:29:191489browse

Solution to the failure of jquery control: 1. Open the corresponding js code file; 2. Pass "$("#xxx").show("slow",function(){$(this).css ("display","block")});" just do it.

What to do if jquery control fails

The operating environment of this article: windows7 system, jquery3.2.1 version, DELL G3 computer

What should I do if the jquery control fails?

About jquery's problem of hiding and displaying controls

Generally, if we want to dynamically display or hide html jsp controls, we can use jquery's own methods

 $("#id").hide();
 
 $("#id").show();

But sometimes when we dynamically control the hiding or display of elements in the control, failure may occur.

For example, if th tr in a div or li in ul hide the div ul, it may not be possible to hide the controls inside, so this will fail.

Solution:

   $("#xxx").hide("slow",function(){$(this).css("display","none")}); 
 
   $("#xxx").show("slow",function(){$(this).css("display","block")});

For the slow function, I looked at the source code and found that it is a speed control for hiding or displaying.

Optional parameters include fast and _default.

As for the choice, it depends on your own preferences.

Recommended learning: "jquery video tutorial"

The above is the detailed content of What to do if jquery control fails. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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