1<script>
2$(document).ready(function(){
3 $("#myBtn").click(function(){
4 var elmId = $("#test").attr("id");
5 alert(elmId);
6 });
7});
8</script>
9
10<body>
11 <div id="testDiv">Data of the Div</div>
12 <br>
13 <button type="button" id="myBtn">Show Div ID</button>
14</body>