Home > WeChat Applet > Mini Program Development > How to obtain user input in a mini program

How to obtain user input in a mini program

Release: 2020-03-18 14:22:41
Original
2537 people have browsed it

How to obtain user input in a mini program

For components that can obtain user input, you need to use the component's attribute bindchange to synchronize the user's input content to AppService.

<input id="myInput" bindchange="bindChange" />
<checkbox id="myCheckbox" bindchange="bindChange" />
var inputContent = {}

Page({
  data: {
    inputContent: {}
  },
    bindChange: function(e) {
        inputContent[e.currentTarget.id] = e.detail.value
    }
})
Copy after login

bindChange is the change event of the input box. The bindchange provided by WeChat still has minor support issues. Currently, this event can only be triggered by losing focus.

Recommended learning: Small program development

The above is the detailed content of How to obtain user input in a mini program. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template