Problem

Create a Lightning Web Component (LWC) that allows users to enter their name and displays it on the screen.

Complete the given practice example to read values from an input field and display on screen.

Instructions

  • Use lightning-input tag to create the input text field
  • Use paragraph (<p>) tag with inner text as the name to display the output on screen.

Sample output

lwc read input fields demo

Note : This exercise introduces you to creating a simple LWC component to read a value from an input field using the 'onchange' event handler and display it on the screen. Focus on meeting the requirements, and feel free to validate your code using the execute button.

Refer to the official LWC documentation link for more details on data binding in LWC.

To learn more about lightning web components, click here to visit the lightning web components developers guide

  • <>lwcReadInputValues.html
  • JSlwcReadInputValues.js
  • #lwcReadInputValues.css
Loading...
show full screen editor