popup with menu - SO question

by Gerald Gillespie

HTML

<button class="choose">IwantThisText</button>
<button class="choose">OrIwantThisText</button>

<input class="choose" value="this is an input so you would use val"/>

JavaScript

/* function test(name) {
    alert($(name).attr("value"));
}
function testTwo(name) {
    alert(name);
} 
*/

$('.choose').on('click', function(){
    var $this = $(this);
    console.log($this);
    alert('text: '+$this.text()+'\nval: '+$this.val());
    
}); // end on click