I need to know about selecting multiple checkboxes in html using meteor.I made a sample. In this example, select more than one check box. How to get selected data and how to store data in an array. Can you see the code below and suggest me what to do?
Storing parts in an array, suppose arrayname = Bike, car, computer (these are selected items)
HTML code:
<form id="cb-form" action="action">
<input type="checkbox" name="owns" value="Bike">Bike<br/>
<input type="checkbox" name="owns" value="Car">car<br/>
<input type="checkbox" name="owns" value="Refridgerator">Refridgerator<br/>
<input type="checkbox" name="owns" value="Mobile">Mobile<br/>
<input type="checkbox" name="owns" value="Tablet">Tablet<br/>
<input type="checkbox" name="owns" value="Computer">Computer<br/>
<input type="submit" value="send" />
</form>
JS Code:
Template.login.events
({
'submit #cb-form' : function (e,t)
{
if (typeof console !== 'undefined')
console.log("You pressed LOGIN Button");
e.preventDefault();
}
});
source
share