Side navigation
#1211 closed bug (fixed)
Opened May 20, 2007 11:08AM UTC
Closed May 23, 2007 01:29PM UTC
Last modified March 15, 2012 06:18PM UTC
$('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: |
Description
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/
Snippet:
$('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?
Cheers
Phil
Attachments (0)
Change History (3)
Changed May 23, 2007 01:29PM UTC by comment:1
resolution: | → fixed |
---|---|
status: | new → closed |
Changed May 17, 2011 03:22PM UTC by comment:2
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"> $(document).ready(function(){ $("#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(){ $(this).closest("tr").next("tr").toggle(); $(this).find(".arrow").toggleClass("up"); }); //$("#report").jExpand(); }); </script>
Hope this helps.
Changed May 17, 2011 04:41PM UTC by comment:3
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.
This is working for me with jQuery 1.1.3a/latest SVN