I have python 2.7 running on google app engine, and I am trying to create a click event using html. I have no idea how to do this. any help would be appreciated. here is my html code.
body = '''
<button id='b'>I'm a button</button>'''
I have python 2.7 running on google app engine, and I am trying to create a click event using html. I have no idea how to do this. any help would be appreciated. here is my html code.
body = '''
<button id='b'>I'm a button</button>'''
You're looking for the onClick
attribute to execute a javascript function when clicked. This is reasonably well-documented and you should be able to find examples using any search engine.
http://www.w3schools.com/tags/ev_onclick.asp
<element onclick="script">
In your case, perhaps:
script = "myFunction()"
body = "<button id='b' onclick='" + script + "'>I'm a button</button>"
Note this assumes you're using a python script to create the HTML which will render the page(s). The solution (without more detail/clarification) is obviously the onClick
attribute, but that calls a javascript function.
If you need to call python function, see this link on SO: