in my code i have applied click event on an img tag and it is not working at all but when i applied the same code for onclick on same tag it started working perfectly . following is the code :-
// closing div with click on img .
$('img.close_url').click(function(){
alert('close');
$('div.urlResult').hide();
$('input#hidden_url_title').val();
$('input#hidden_url_content').val();
$('input#hidden_is_url').val(0);
});
// closing div by applying onclick on img tag
function closeUrl()
{
$('div.urlResult').hide();
$('input#hidden_url_title').val();
$('input#hidden_url_content').val();
$('input#hidden_is_url').val(0);
}
Html:
//content to be loaded in #results element
var content = '<div class = "extracted_url">'+ inc_image +'<div class="extracted_content"><h4><a href="'+extracted_url+'" target="_blank">'+data.title+'</a><img class = "close_url" src ="'+IMAGE_PATH+'/cross-grey.png"/></h4><p>'+data.content+'</p><div class="thumb_sel"><span class="prev_thumb" id="thumb_prev"> </span><span class="next_thumb" id="thumb_next"> </span> </div><span class="small_text" id="total_imgs">'+img_arr_pos+' of '+total_images+'</span><span class="small_text"> Choose a Thumbnail</span></div></div>';
/* above is the html that I am adding with javascript function . And this is not inside .ready */