So I have multiple div containing same HTML structure, class names, and attributes. They are identical except the content it outputs. Each div has an input box within with the same class. How do I get the specific value of each input box? I am guessing I would use 'this' but I cannot figure out how to exactly use 'this' to get the specific value of each text box. I don't want to use each because that outputs an array of values.
<div>
<input class="player-input" type="text"></input>
<button class="enter">Enter</button>
<p>Lorem Ipsum<p>
</div>
<div>
<input class="player-input" type="text"></input>
<button class="enter">Enter</button>
<p>Lorem Ipsum<p>
</div>
I am using Meteorjs and events are set up like so:
Template.players.events({
'click .enter': function(){
//code
},
'keydown .player-input': function(e){
if (e.which == 13){
//code
}
}
});
How would I get the value of each specific input element with jQuery?