Why I am getting errors with the lastest version of PyScript?

<html>

<head>

    <title> Learn DOM for PyScript </title>

    <link rel='stylesheet' type='text/css' media='screen' href='https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css'>

    <link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />

    <script defer src="https://pyscript.net/latest/pyscript.js"></script>

</head>

<body>

<h1>Learn DOM Manipulation using PyScript</h1>

<h2>Simple String Counter using Python 🐍</h2>

<br>

<p>Input Text</p>

<textarea name="input_text" id="input_text" placeholder="Enter your text...."></textarea>

<br>

<button id="run" type="button" class="button is-primary" pys-onClick="count">Count</button>
<button id="clear" type="button" class="button is-danger" pys-onClick="clear">Clear</button>

<p>Output from 🐍</p>

<p id = 'output'></p>
    
</body>

<py-script>

input_text = Element("input_text")    

op = Element("output")

def clear(*args, **kwargs):
    input_text.clear()

def count(*args, **kwargs):
    number = len(input_text.value)
    op.write(number)


</py-script>


</html>

Hi @Jorge , and welcome to the forum!

The preferred syntax for creating event handlers in PyScript is now to use py-[event] , where [event] is one of the many DOM Events. As in py-click=... or py-mouseover=... etc.

The “pys-on*” style has been deprecated and will be removed in a future version.

With the py-[event]syntax, the meaning of the attribute has changed slightly. Rather than passing a Callable, you give it actual python code to be evaluated. So in your case, you’d write py-click="count()" or py-click="clear().