-
Notifications
You must be signed in to change notification settings - Fork 1
/
show_input_value.html
66 lines (50 loc) · 1.71 KB
/
show_input_value.html
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
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PyScript Test</title>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio,line-clamp"></script>
</head>
<body>
<header>
<h1 class="text-3xl font-bold underline">
PyScript Sample Page
</h1>
</header>
<main>
<div class="prose">
<p>
<section>
<h1>Show User Input Value</h1>
</div>
<div>
<input id="InputFieldValueBox" class="border flex-1 mr-3 border-gray-300 p-2 rounded" type="text">
<button id="new-task-btn" class="p-2 text-white bg-blue-600 border border-blue-600 rounded" type="submit" pys-onclick="show_input_value">
Show Value
</button>
</div>
<label id='value'></label>
</div>
</section>
</p>
<p>
If you want to get more information, please click <a href="https://github.com/pyscript/pyscript/blob/main/GETTING-STARTED.md" target="_blank" rel="noopener noreferrer">this link</a>.
</p>
<py-script>
# Selecting JS element for Value / Text
Input_Value_Box = Element("InputFieldValueBox")
# Needs an argument passed - don't ask me why!
def show_input_value(test):
# Getting The Value Of The Text
input_text = Input_Value_Box.element.value
pyscript.write('value',input_text)
</py-script>
</div>
</main>
<footer>
<a href="github.com/MarketingPipeline">©️2022 github.com/MarketingPipeline</a>
</footer>
</body>
</html>