Home > Web Front-end > JS Tutorial > body text

JS sample code to change p display status when clicking on checkbox

小云云
Release: 2017-12-20 09:01:45
Original
1289 people have browsed it

This article will share with you a JS sample code to implement clicking on the check box to change the display status of p. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.

First on the page:

 

    

     

元/L

         

     

元/L

          

    

元/L

   

Copy after login

Then the implementation in jquery

jQuery(document).ready(function($) { 
 
//是否添加活动内容 
 
$("#isHaveActive").change(function(){  
 
   var p = $("#active");  
   p.css("display") === "none" && p.show() || p.hide(); 
 
 });
Copy after login

Related recommendations:

JS click on the link to switch Implementation method of displaying hidden content

js method of clicking to select text_javascript skills

js click return to jump to the specified page implementation process_ javascript skills

The above is the detailed content of JS sample code to change p display status when clicking on checkbox. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!