Coding Challenge
Let’s learn how to use JavaScript functions in Python while using Transcrypt.
We'll cover the following
Problem Statement
In this code challenge, we will add two buttons:
- The first button will display a random number in the browser’s alert pop-up window.
- The second button will increment the number in the HTML file by one.
Modify the get_number()
function in the js_function.py
file to use the JavaScript window.alert()
function to display the generated number in a web browser alert pop-up window instead of displaying it on the screen.
Then, write the number_increment
function to get the number in the HTML file using the getElementById
function, then saving it after incrementing it. To call the number_increment
function we just created add another button using the button
HTML.
Get hands-on with 1400+ tech skills courses.