Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 11 years ago

#1211 closed bug (fixed)

$('td').bind("click", function(){}); doesn't work in internet explorer 7

Reported by: tallphil Owned by:
Priority: major Milestone: 1.1.3
Component: event Version: 1.1.2
Keywords: table, bind, click, onclick Cc:
Blocked by: Blocking:


I'm trying to make a clickable table to save preferences using the bind("click" function with a table.

Link: http://www.tallphil.co.uk/feeds/


$('td').bind("click", function(){
	if($(this).css('background-color') == 'rgb(237, 252, 235)'){ 
		$(this).css('background-color','rgb(245, 207, 207)');
		selected[$(this).attr('id')] = false;

The code works perfectly in firefox, but has no effect in internet explorer 7. I presume that it's a problem with using the onclick handler with a td element, any way to get around this?



Change History (3)

comment:1 Changed 16 years ago by brandon

Resolution: fixed
Status: newclosed

This is working for me with jQuery 1.1.3a/latest SVN

comment:2 Changed 12 years ago by Oaresome

I had this same problems when I was trying to use the expand function, not when you click a row but when you click a cell. I ended up putting <a> within the cell to get it working in IE. Worked fine in firefox. Javascript as below:

<script type="text/javascript">  
            $("#report tr:odd").addClass("odd");
            $("#report tr:not(.odd)").hide();
            $("#report tr:first-child").show();

            $("#report tr.odd a").click(function(){
            //$("#report tr.odd td.comments").click(function(){

Hope this helps.

comment:3 Changed 12 years ago by Rick Waldron

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, I've created this boilerplate: http://jsfiddle.net/rwaldron/da3nM/ Open the link and click to "Fork" in the top menu.

Note: See TracTickets for help on using tickets.