Thanks for replying!
I have modified my code including your code and with certain changes to work extact what i need is as follows:
In css:
.mydiv {
background: url("http://placehold.it/200x200&text=Shekhar img1") no-repeat;
height: 150px;
width: 150px;
position: relative;
margin:10px;
float:left;
}
.row {
position: relative;
left: -50%
}
.image-holder
{
display:block;
height: 20px;
text-align: center;
margin-top: 101%;
}
.image
{
height:20px;width:20px;vertical-align: top;
}
In html markup:
<div id="header-image1" class="mydiv">
</div>
<div id="header-image2" class="mydiv">
</div>
<div id="header-image3" class="mydiv">
</div>
<div id="header-image4" class="mydiv">
</div>
In script:
$(document).ready(function(){
$(".mydiv").on("click",function(){
$("#dynamicdiv").remove();
$(this).append("<div id='dynamicdiv' class='image-holder'><img src='imagepath' class='image' ></div>");
});
});
NOTE: Use of "on" is NOT SUPPORTED in version 1.7. So, have used 2.0.0 version.
View Full Working Code Here
Thanks @Lav G