Hi. I have a problem with IE8. The code below works in chrome and firefox, but not in IE. Once it arrives on that first line, the IE error says "expected object."
What I have is an img within a div # prods. When clicked, this code tests [if what was clicked is an img "& &" if its id is different from "# img-display" (id of another img within the div that should not trigger the function) & & if the id is different from the value of eh_tb].
$('#prods').on('click', find("img"), function(event) {
if( $(event.target).is('img') && ($(event.target).attr('id') != 'img-display') &&
($(event.target).attr('id') != eh_tb) ) {
//PROCESSAMENTO AQUI
}
});
What's in the HTML is a menu. And an empty div # prods. Qd I click on a menu link, it calls a PHP function by ajax to display the contents of a folder inside #prods.
The PHP code puts it inside #prods:
- a series of imgs that are the thumbnails (these are the imgs tested in the function qd clicked);
- a "p";
- an "img" which is # img-display;
NOTE: The variable "eh_tb" holds which thumbnail is currently displaying your content. It's just not to load the function and end up loading the same content again.
I had to use event.target because the content is generated dynamically by PHP. Does anyone have a solution for this code to run in IE8?