Trying to get the id or name of the button that has been clicked. But I only get an undefined message in the popup when I try to access the id or name of the button. Could someone point me in the right direction to get this working?
<!DOCTYPE html PUBLIC "-//W2C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Testing : Buttons</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<div id="buttons" style="width:100%;height:100%">
<p id="custom_buttons" >
</p>
</div>
<div id="footer">
</div>
<script type="text/javascript">
$(function() {
var datasetPresets = ["Python", "Java", "C++"];
var datasetPresetsContainer = $("#custom_buttons");
$.each(datasetPresets, function(index, value) {
datasetPresetsContainer.append("<button class=std_buttons value=" + value + ">" + value + "</button>");
});
$("button.std_buttons").click(function () {
var button = $(this);
alert(button.id);
});
});
</script>
</body>
</html>
</html