Как вариант...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<script src='https://code.jquery.com/jquery-latest.js'></script>
<!--
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
</style>
<script type='text/javascript'>
$(document).ready(function() {
var k = '';
$('#myButtons button').on('click', function() {
k = this.id;
});
$('#test').on('click', function() {
alert(k);
});
});
</script>
</head>
<body>
<div id = "myButtons">
<button id="sumki">Сумки</button>
<button id="plyshki">Сумки</button>
</div>
<button id="test">Показать k</button>
</body>
</html>
P.S.
Твой пример вовсе плохой...