jquery .on container element attached to multiple selectors

by amol9supe

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/smoothness/jquery-ui.css">
<div id="container">
   //Elements here appear dynamically
   <div id="id1" class="common-id">hulk</div>
   <div id="id2" class="common-id">rambo</div>
</div>

JavaScript

$('#container').on("click", ".common-id", function() {
    alert(this.id)
 });