Does the image exist in the DOM on page load complete?
On Jun 30, 1:44 pm, Adwin Wijaya <[EMAIL PROTECTED]> wrote:
> Hi ...
>
> I have table and inside contains image which class name = 'reason_img'
>
> my js script was like this
> <script>
> $(document).ready(function(){
> ...... another initialization goes here ....
> $('.reason_img').bind('click',function(e)
> {display_reason(this);});
> ....
> });
>
> function display_reason(el){
> alert('test');
> }
> .....
> </script>
>
> when i click on every image which has "reason_img" class .. it won't
> work ..
>
> I tried to type $('.reason_img').bind('click',function(e)
> {display_reason(this);}); in my firebug
> and everything works well ..
>
> dunno why ...
>
> is this a bug ? or should i place it outside the $
> (document).ready() ?