Home > Web Front-end > JS Tutorial > How to hide dl elements in jquery

How to hide dl elements in jquery

WBOY
Release: 2021-12-13 17:07:57
Original
2449 people have browsed it

Jquery method of hiding dl elements: 1. Use the "$(dl element)" statement to obtain the specified dl element object; 2. Use the hide() method to hide the obtained dl element object. The syntax is: "dl element object.hide();".

How to hide dl elements in jquery

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

How to hide dl elements in jquery

We can use the hide() method to hide dl elements. We can first use $("dl" ) statement obtains the element object of the element, and then uses the hide() method to hide it.

The example is as follows:

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $(".btn1").click(function(){
  $("dl").hide();
  });
  $(".btn2").click(function(){
  $("dl").show();
  });
});
</script>
</head>
<body>
<dl>
   <dt>计算机</dt>
   <dd>用来计算的仪器 ... ...</dd>
   <dt>显示器</dt>
   <dd>以视觉方式显示信息的装置 ... ...</dd>
</dl>
<button class="btn1">Hide</button>
<button class="btn2">Show</button>
</body>
</html>
Copy after login

Output result:

How to hide dl elements in jquery

Related video tutorial recommendation: jQuery video tutorial

The above is the detailed content of How to hide dl elements in jquery. 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