Java-scipt function does not get fired in IE 7 and above versions

Java-scipt function does not get fired in IE 7 and above versions

Hi,

when clicked on below image the ClosePopup function is called.

$('#' + popID).fadeIn().css({ 'width': Number(popWidth) }).prepend('<div style="float: right; margin-top: -40px; margin-left: 0px; margin-right: -42px;"><img onclick="return ClosePopup();" src="../../Images/glyphicons_197_remove.png" alt="close" title="close" style="cursor:pointer" class="img_btn_close" /></div>');


It works fine for first three times but does not get fired for the fourth and consicutive times in IE 7 and above versions.

 function ClosePopup() {
         $('.img_btn_close').remove();
         $('#fade').remove();
         document.getElementById('popup_viewprofile_user').style.display = 'none';
       
     }

The above code works fine in Firefox and chrome.