eye icon in inputveld

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Hendrik jorna

hendrik jorna

03/10/2024 21:56:04
Quote Anchor link
Hallo,
Ik ben bezig met een script en ik wil het oogicoon in het invoerveld hebben, maar het verschijnt ernaast. Heeft iemand een idee hoe ik dit kan oplossen?

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PIN-Code Eingabe</title>
    <style>
        body {
            font-family: "Inter", system-ui, -apple-system;
            background-color: #ffffff;
            margin: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            padding: 20px;
        }
        .login-container {
            max-width: 400px;
            width: 100%;
            background-color: #ffffff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            text-align: center;
        }
        .form-group {
            margin-bottom: 15px;
            position: relative; /* Voor de positie van het oogicoon */
        }
        .form-control {
            width: 100%;
            max-width: 220px; /* Aangepaste breedte */
            height: 30px; /* Verminderde hoogte */
            padding: 5px 40px 5px 10px; /* Padding voor het oogicoon */
            font-size: 18px;
            border: 1px solid #ddd;
            border-radius: 5px;
            text-align: left; /* Tekst links uitlijnen */
            margin: 0 auto; /* Centeren */
        }
        .eye-icon {
            position: absolute;
            right: 10px; /* Ruimte van de rechterkant */
            top: 50%;
            transform: translateY(-50%); /* Verticaal centreren */
            cursor: pointer;
            font-size: 18px; /* Grootte van de emoji */
            pointer-events: auto; /* Klikbaar maken */
        }
        .mobile-buttons {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 10px;
            margin-top: 10px;
        }
        .btn-number {
            height: 45px;
            width: 90px;
            font-size: 20px;
            background-color: #2870ED;
            color: white;
            border: none;
            border-radius: 25px;
            transition: background-color 0.3s;
        }
        .btn-number:hover {
            background-color: #1E5BB5;
        }
        .btn-primary {
            height: 45px;
            font-size: 20px;
            background-color: #2870ED;
            color: white;
            border: none;
            border-radius: 25px;
            margin-top: 15px;
            transition: background-color 0.3s;
            width: 90%;
            max-width: 280px;
            margin-left: auto;
            margin-right: auto;
        }
        .btn-primary:hover {
            background-color: #1E5BB5;
        }
    </style>
</head>
<body>

<div class="login-container">
    <h2 class="login-title">Geben Sie Ihren 4-stelligen PIN ein</h2>
    <div class="form-group">
        <input type="password" class="form-control" id="pinInput" maxlength="4" required="">
        <span class="eye-icon" onclick="togglePinVisibility()">
 
PHP hulp

PHP hulp

06/10/2024 04:32:13
 
- Ariën  -
Beheerder

- Ariën -

03/10/2024 22:16:31
Quote Anchor link
Je vergeet wat divjes en spans af te sluiten.
 
Hendrik jorna

hendrik jorna

03/10/2024 22:24:35
Quote Anchor link
dit is het volledige script
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PIN-Code Eingabe</title>
    <style>
        body {
            font-family: "Inter", system-ui, -apple-system;
            background-color: #ffffff;
            margin: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            padding: 20px;
        }
        .login-container {
            max-width: 400px;
            width: 100%;
            background-color: #ffffff;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            text-align: center;
        }
        .form-group {
            margin-bottom: 15px;
            position: relative; /* Voor de positie van het oogicoon */
        }
        .form-control {
            width: 100%;
            max-width: 220px; /* Aangepaste breedte */
            height: 30px; /* Verminderde hoogte */
            padding: 5px 40px 5px 10px; /* Padding voor het oogicoon */
            font-size: 18px;
            border: 1px solid #ddd;
            border-radius: 5px;
            text-align: left; /* Tekst links uitlijnen */
            margin: 0 auto; /* Centeren */
        }
        .eye-icon {
            position: absolute;
            right: 10px; /* Ruimte van de rechterkant */
            top: 50%;
            transform: translateY(-50%); /* Verticaal centreren */
            cursor: pointer;
            font-size: 18px; /* Grootte van de emoji */
            pointer-events: auto; /* Klikbaar maken */
        }
        .mobile-buttons {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 10px;
            margin-top: 10px;
        }
        .btn-number {
            height: 45px;
            width: 90px;
            font-size: 20px;
            background-color: #2870ED;
            color: white;
            border: none;
            border-radius: 25px;
            transition: background-color 0.3s;
        }
        .btn-number:hover {
            background-color: #1E5BB5;
        }
        .btn-primary {
            height: 45px;
            font-size: 20px;
            background-color: #2870ED;
            color: white;
            border: none;
            border-radius: 25px;
            margin-top: 15px;
            transition: background-color 0.3s;
            width: 90%;
            max-width: 280px;
            margin-left: auto;
            margin-right: auto;
        }
        .btn-primary:hover {
            background-color: #1E5BB5;
        }
    </style>
</head>
<body>

<div class="login-container">
    <h2 class="login-title">Geben Sie Ihren 4-stelligen PIN ein</h2>
    <div class="form-group">
        <input type="password" class="form-control" id="pinInput" maxlength="4" required="">
        <span class="eye-icon" onclick="togglePinVisibility()">?????</span> <!-- Emoji als oogicoon -->
    </div>
    <div class="mobile-buttons">
        <button type="button" class="btn-number" onclick="appendNumber(1)">1</button>
        <button type="button" class="btn-number" onclick="appendNumber(2)">2</button>
        <button type="button" class="btn-number" onclick="appendNumber(3)">3</button>
        <button type="button" class="btn-number" onclick="appendNumber(4)">4</button>
        <button type="button" class="btn-number" onclick="appendNumber(5)">5</button>
        <button type="button" class="btn-number" onclick="appendNumber(6)">6</button>
        <button type="button" class="btn-number" onclick="appendNumber(7)">7</button>
        <button type="button" class="btn-number" onclick="appendNumber(8)">8</button>
        <button type="button" class="btn-number" onclick="appendNumber(9)">9</button>
        <button type="button" class="btn-number" onclick="clearPin()">C</button>
        <button type="button" class="btn-number" onclick="appendNumber(0)">0</button>
        <button type="button" class="btn-number" onclick="backspace()">?</button>
    </div>
    <button type="submit" class="btn-primary">Weiter</button>
</div>

<script>
    function togglePinVisibility() {
        const pinInput = document.getElementById('pinInput');
        pinInput.type = pinInput.type === 'password' ? 'text' : 'password';
    }

    function appendNumber(num) {
        const pinInput = document.getElementById('pinInput');
        if (pinInput.value.length < 4) {
            pinInput.value += num;
        }
    }

    function clearPin() {
        document.getElementById('pinInput').value = '';
    }

    function backspace() {
        const pinInput = document.getElementById('pinInput');
        pinInput.value = pinInput.value.slice(0, -1);
    }
</script>

</body>
</html>
Gewijzigd op 03/10/2024 22:25:08 door hendrik jorna
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.