Unverified

Name

Reveal-Content-Password

About

Add this to a HTML Widget. And then add containers, items, or anything that you want and assign them the ID sec1 or sec2 (as in the code) - but you could add any name that you want. Make sure that you change the code to match your IDs. So if you change sec1 to be red, then change sec1 in the code to be red.

Language

HTML

Rating

Voted: 0 by 0 user(s)

Codevault

WebSquadron

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.4

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

09/01/2024

Important Note

This snippet has the following status:

Unverified

This snippet has not been verified, use with caution and at your own risk. See details provided by author in sidebar and click below to find out more.

Reveal-Content-Password

 
                    
1<input type="text" id="passwordField" placeholder="Enter password">
2<script>
3 document.getElementById('passwordField').addEventListener('input', function() {
4 var value = this.value;
5 
6 if (value === '') {
7 // Set both sec1 and sec2 to display none if passwordField is empty
8 document.getElementById('sec1').style.display = 'none';
9 document.getElementById('sec2').style.display = 'none';
10 } else if (value === 'CA') {
11 document.getElementById('sec1').style.display = 'block';
12 document.getElementById('sec2').style.display = 'none';
13 } else if (value === 'DA') {
14 document.getElementById('sec1').style.display = 'none';
15 document.getElementById('sec2').style.display = 'block';
16 } else {
17 document.getElementById('sec1').style.display = 'none';
18 document.getElementById('sec2').style.display = 'none';
19 }
20 });
21</script>
22<style>
23 #sec1, #sec2 {
24 display: none;
25 }
26</style>

0

Related Snippets

Please see some snippets below related to this snippet..

General

AI Verified

0

FacetWp - Default featured Image

Added: 7 months ago

Last Updated: 7 months ago

General

AI Verified

0

Add Custom Fields

Added: 6 months ago

Last Updated: 6 months ago

General

Unverified

0

databasemainActivity

Added: 3 months ago

Last Updated: 3 months ago

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

Performance

AI Verified

32

Remove Unused Javascript

Added: 1 year ago

Last Updated: 3 days ago

Remove Unused Javascript - and improve your Page Speed Insight Score

WooCommerce

Pro Verified

10

Deactivate some WooCommerce Checkout Fields

Added: 1 year ago

Last Updated: 2 weeks ago

Deactivate some WooCommerce Checkout Fields from showing

Elementor

AI Verified

6

CSS Grid Aid

Added: 8 months ago

Last Updated: 1 month ago

This can be used for any WordPress Builder to aid working with CSS Grids.