File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -970,7 +970,33 @@ __ADD DIAGRAM HERE__
970
970
971
971
###### Creating a new element
972
972
973
+ New elements can be created by using the ` pydom.create ` method and passing the type of element
974
+ being crated. Here's an example of what it looks like:
973
975
976
+ (To execute and explore the following code, click on the "load" button. The result will be
977
+ conveniently displayed in the box on the below of the code example)
978
+
979
+ ``` python
980
+ from pyweb import pydom
981
+
982
+ # Creating an element directly from pydom creates an unbounded element.
983
+ new_div = pydom.create(" div" )
984
+
985
+ # Creating an element from another element automatically creates that element
986
+ # as a child of the original element
987
+ new_p = new_div.create(" p" , classes = [" code-description" ], html = " Ciao PyScripters!" )
988
+
989
+ # elements can be appended to any other element on the page
990
+ pydom[' #element-creation-example' ][0 ].append(new_div)
991
+ ```
992
+
993
+ <div >
994
+ <h3 >Result will go here</h3 >
995
+ <div id =" pydom-element-createion-example " ></div >
996
+ </div >
997
+
998
+
999
+ For more details about ` pydom.create ` please refer to its reference documentation.
974
1000
975
1001
976
1002
## Workers
You can’t perform that action at this time.
0 commit comments