Home >Web Front-end >Layui Tutorial >How to get the value of input box in layui list
We first create an input, the style name is layui-input. Then the key is to add an id value to it.
Then add a button with an onclick event to trigger getting the value.
In the script code, define a function that is triggered when the button is clicked.
We can use document.getElementById to get the input box, and the parameter is the id value of the input box.
#After the input box is obtained, you can use its value attribute to get the value of the input box. Code: input.value
Related recommendations: "layui framework tutorial"
Then use a simple alert method to pop up and get the value.
Open the page and you can see the input boxes and buttons.
Enter the value in the input box and click the button below.
#After clicking, we can see that the value of this input box has been successfully obtained.
The above is the detailed content of How to get the value of input box in layui list. For more information, please follow other related articles on the PHP Chinese website!