Coding Challenge
Let’s use jQuery in Python while using Transcrypt.
We'll cover the following
Problem statement
Currently our application adds a static text to an ordered list. In this code challenge, we will create an input text box and append the text entered in the list below.
Starting with external_jq.html
, add an HTML input
element and set the initial value attribute to List item
.
Next, we modify the add_item()
inner function in external_jq.py
to get its value from the input element using jQuery. We can use the jQuery val()
method to retrieve the value of the input element. That jQuery method call can be called into the list
element using a Python f-string. Use an if
condition to ensure that no empty strings get listed.
Get hands-on with 1400+ tech skills courses.