filmov
tv
Prompt User To Add Element On Button Click External Javascript HTML

Показать описание
Prompt User To Add Element On Button Click External Javascript HTML
Prompt User To Add Element On Button Click External Javascript HTML
1. a HTML file: Create a button with label "Add element", that would invoke a function from external JavaScript
2. Create a function that would be invoked when "Add element" button is clicked. This function should prompt user to enter the type of element he would like create (i.e, p for paragraph, div, nav, section, footer...), then create the element with text (i.e "paragraph element", "div element",... ) and append it as a child to the body of the document. You can apply an appropriate style of your choice to this newly created element (i.e, background color/border/font/color)
Prompt User To Add Element On Button Click External Javascript HTML
1. a HTML file: Create a button with label "Add element", that would invoke a function from external JavaScript
2. Create a function that would be invoked when "Add element" button is clicked. This function should prompt user to enter the type of element he would like create (i.e, p for paragraph, div, nav, section, footer...), then create the element with text (i.e "paragraph element", "div element",... ) and append it as a child to the body of the document. You can apply an appropriate style of your choice to this newly created element (i.e, background color/border/font/color)