File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- How to write Python in PythonScript
2- ===================================
1+ How to write Python in PythonJS
2+ ===============================
33
4- How to use PythonScript ?
4+ How to use PythonJS ?
55-------------------------
66
7- Install PythonScriptTranslator :
7+ Install `` pythonjs `` :
88
99.. code-block :: sh
1010
Original file line number Diff line number Diff line change 1+ submit = jQuery ("input[type='submit']" )
2+
3+
4+ def on_add ():
5+ input = jQuery ("input[type='text']" )
6+ task = input .val () # fetch the value of the input
7+ if task :
8+ # if it's not empty add it to the list
9+ tasks = jQuery ('#tasks' )
10+ tasks .append ("<li>" + task + "</li>" )
11+ # empty the input field
12+ input .val ('' )
13+
14+
15+ submit .click (on_add )
Original file line number Diff line number Diff line change 1+ < h1 > List of Tasks</ h1 >
2+ < ul id ="tasks ">
3+ </ ul >
4+ < h1 > Add a task</ h1 >
5+ < input type ="text " /> < input type ="submit " value ="Add " />
Original file line number Diff line number Diff line change 1+ < script src ="jquery.js "> </ script >
2+ < script src ="pythonjs.js "> </ script >
3+ < script src ="app.js "> </ script >
Original file line number Diff line number Diff line change 1+ < h1 > List of Tasks</ h1 >
2+ < ul id ="tasks ">
3+ < li > Task one [< span > done</ span > ]</ li >
4+ < li > Task two [< span > done</ span > ]</ li >
5+ < li > Two three [< span > done</ span > ]</ li >
6+ </ ul >
7+ < h1 > Add a task</ h1 >
8+ < input type ="text " /> < input type ="submit " value ="Add " />
You can’t perform that action at this time.
0 commit comments