How can I retrieve the the actually value defined within the html element attribute named 'value'?
Before a user signs up, I am setting a session variable with a value that shall be either 'publisher' or 'reader' depending on which div they click on. This session value will be used upon user creation.
<template name="authJoinType">
<div class="container join-type">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<a href="{{pathFor route = 'join'}}">
<div class="join-type-inner" id="userTypeSelect" value="reader">Reader</div>
</a>
</div>
<div class="col-xs-6 col-sm-6 col-md-6">
<a href="{{pathFor route = 'join'}}">
<div class="join-type-inner" id="userTypeSelect" value="publisher">Publisher</div>
</a>
</div>
</div>
</div>
</template>
client.js (Trying to set the session variable to either 'reader' or 'publisher' depending which div out of the two they click on)
Template.authJoinType.events({
'click div.join-type-inner': function(e, tmpl) {
var userType = $(e.target).find('#userTypeSelect').val();
Session.set('userType', userType);
var selectedUserType = Session.get('userType');
console.log(selectedUserType); // this is printing out 'undefined'
}
});
Help? Am I targeting the incorrect div to begin with?