Skip to content

How to modify button attribute with Pyscritp #1206

Answered by FabioRosado
joseludenia asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a full working code that you can use:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Enable Disable Buttons</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="stylesheet" href="https://pyscript.net/releases/2022.12.1/pyscript.css" />
    <script defer src="https://pyscript.net/releases/2022.12.1/pyscript.js"></script>
</head>
<body>
    <button id="button-1" py-click="toggle1()">Button 1</button>
    <button id="button-2" py-click="toggle2()">Button 2</button>
    <py-script >
        def toggle1():
            button1 = Element("button-1").element
            button2 = Element("button-2").element

         …

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
6 replies
@joseludenia
Comment options

@FabioRosado
Comment options

@FabioRosado
Comment options

@joseludenia
Comment options

@FabioRosado
Comment options

Comment options

You must be logged in to vote
2 replies
@joseludenia
Comment options

@FabioRosado
Comment options

Answer selected by FabioRosado
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants