[ Meteor JS ] – How to call a function when I click in a button ?

Always when you want call a function by any event in the screen you need create the function in events area. Look this exemple :

<template name="myTemplate">
<button type="button" id="addButton" >
    My button

This code above is to create the button in a html file. Now in the js file you need :

    'click #addButton': function (e) {
        // implement here the code on click

In the same way you can use the onChange, onFocus and others events to call your functions.








Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s