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

How to obtain user input in a mini program

尚
Original
2020-03-18 14:22:412534browse

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
    }
})

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!

Statement:
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