Jquery : 3.x, Tomcat7
Problem :
var htmlStr
for(var i=0;i<data.length;i++){
htmlStr += "<input class='my_button' type='button' data-value='"
+ data[i].value + "' value='" + data[i].value + "'/>";
}
$("#keyvals").html(htmlStr);
$('.my_button').click(function(){
alert(this.data-value);
});
Question : For the dynamically created 'input with same class as class='my_button' , How to get the value on clicked ?
Help is highly appreciated.