Skip to main content

Bug Tracker

Side navigation

#12444 closed bug (invalid)

Opened September 03, 2012 08:24AM UTC

Closed September 04, 2012 03:01PM UTC

jquery click event not firing on dynamically created div

Reported by: mtotoum@aa.jo Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:
Description

for a week I tried every possible way to make this work on fireFox, Chrome or Opera and no use

it works fine on IE

a sample of what I am doing is here

for (i=0;i<=3;i++){

myAlbumHTML +='<div style="width:150px;display:inline;" >';

myAlbumHTML +='<div style="vertical-align:text-top; display:inline-block; text-align: center; border: solid 2px #000080;" ' + 'ID="' + i + '" class="Albums" onclick="DoClick(this)" >';

myAlbumHTML +='<table><tr><td>';

myAlbumHTML +='<img src="Image/Src"';

myAlbumHTML +='" alt="" ></img>';

myAlbumHTML +='</td></tr><tr><td>';

myAlbumHTML +='Title</td></tr><tr><td>2nd Title' ;

myAlbumHTML +='</td></tr></table></div></div>';

};

$("#cont").html(myAlbumHTML);

function DoClick(obj){alert($(obj).attr("ID"));}

I also tried $(".albums").on("click",DoClick);

its working just like I want on IE . . . but not on chrome or FF

Attachments (0)
Change History (1)

Changed September 04, 2012 03:01PM UTC by timmywil comment:1

resolution: → invalid
status: newclosed

Please ask for help on the forums or on the #jquery irc channel.