I'm having a problem when taking the data from a data-id with javascript data, what I want to try if I have several buttons to say that each button has a different value until then it's fine but when calling each button with different values calls me first.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="button" id="button1" data-id="sa!" onclick="funcionData()"> click1 </button>
<button type="button" id="button1" data-id="sasasa!" onclick="funcionData()"> click2 </button>
<script type="text/javascript">
function funcionData(){
alert($("#button1").data("id"));
}
</script>
</body>
</html>
I give you the example of something I want to do if you see button one as the data-id="sa!" attribute. and the button 2 with click2 with the data-id = sasasa "but at the moment of calling it, only the first and not the second return to me