Home >Web Front-end >Layui Tutorial >How to set checkbox in layui
First you need to introduce layui’s js script file and css style file. If you need to use jquery, the corresponding files are also introduced.
#html, we write the corresponding check box control, which is the commonly used checkbox. But what needs to be noted here is that a title value must be added to the checkbox, and the control must be placed in a form with the style layui-form.
In the ready function after the page is loaded, (jquery is used here), we need to introduce the form component of layui, and then call the render method.
That’s it, basically it’s OK, there’s not much complexity. Run the page and you can see the beautiful checkbox appear.
Related recommendations: "layui framework tutorial"
But when I see the pictures above, it seems that some pictures are not displayed properly. ? In fact, this is caused by the custom fonts in layui not loading properly. We need to copy the fonts in layui to our own site, and just put the entire font folder in the same directory as css and js.
# Refresh the page and you will see a beautiful check box.
Click on the first check box to see the selected status.
The above is the detailed content of How to set checkbox in layui. For more information, please follow other related articles on the PHP Chinese website!