views:

413

answers:

3

I tried to bind click and animate function on a img tag. Its works fine in firefox. but went wrong with IE. So i simplified the code and tested only for click . Even click function is not clled. Here is my click function for my img tag with class 'arrowimg'.

$('.arrowimg').click(function(){alert("Show me")});

I get this alert in FF but not in IE what might be the problem?

EDIT:here is my HTML generated code for img tag

<img src='http://localhost/gowri/Project/SS4U/public/images/symbols/advartise_right_arrow_NEW.gif' id="next" class="arrowimg" alt="advartise_right_arrow" />
+1  A: 

Generally, IE6 should be able to handle this. Make sure that you're getting any matches at all for your selector

alert($('.arrowimg').length);

If not, there may be something else that have gone wrong at an earlier stage.

David Hedlund
yes i get the response it matches to two img elements i have used in that page
Goysar
+1  A: 

Make sure it's in the document ready event and then you end the alert with a semi colon.

$(document).ready(function() {
    $('.arrowimg').click(function(){alert("Show me");});
});

EDIT: Looks like there's something up with your markup:

You've got double quotes around 'advartise_right_arrow_NEW.gif'.

Should it be this instead:

<div id="nextdiv">
    <img src="<?php echo _SS4U_SYM.'advartise_right_arrow_NEW.gif'; ?>" 
        id="next" class="arrowimg" alt="advartise_right_arrow"/>
</div>
GenericTypeTea
yes i have the code inside document ready!and even after adding semi colon to the alert it is not getting displayed.
Goysar
@kobi sorry i cant get you. which function part. what poor?
Goysar
I tried by changing the double quotes into single quotes still no improvement.
Goysar
+1  A: 

Try this,

$('.arrowimg').click(function(event){
   event.preventDefault();
   alert("Show me");
});
mukamaivan