I am not able to get the src attribute of the image that i created using the .append method in Jquery. I am able to get src when i type the element in html file but not when i append it. In short the alert method at the end of below code doesnt give the src of the img.
HTML:
<button onclick="createlm()">click</button>
<div class="row"></div>
JQUERY:
//function to append img element..
function createlm(){
$(".row").append("<img src='image/Chrysanthemum.jpg' width='100px' height='100px'>");
};
//function to get src attribute
$(window).load(function(){
$(".row>img").click(function(){
var imgsrc = $(this).attr("src");
alert(imgsrc);
});
});